在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ HTML/ ToolbarAndroid
JavaScript 環(huán)境
計(jì)時(shí)器
Native 模塊(iOS)
入門
在設(shè)備上運(yùn)行
ProgressBarAndroid
iOS 應(yīng)用程序狀態(tài)
網(wǎng)絡(luò)
ToolbarAndroid
測(cè)試
輔助功能
網(wǎng)絡(luò)信息
DrawerLayoutAndroid
樣式表
手勢(shì)應(yīng)答系統(tǒng)
與現(xiàn)有的應(yīng)用程序集成
樣式
教程
不透明觸摸
調(diào)試 React Native 應(yīng)用
iOS 活動(dòng)指示器
導(dǎo)航器
無反饋觸摸
動(dòng)畫布局
Web 視圖
鏈接庫
像素比率
React Native 官網(wǎng)首頁介紹
iOS 導(dǎo)航器
交互管理器
全景響應(yīng)器
SwitchAndroid
TabBarIOS.Item
相機(jī)滾動(dòng)
ToastAndroid
iOS 震動(dòng)
BackAndroid
文本輸入
iOS 選擇器
應(yīng)用程序注冊(cè)表
iOS 開關(guān)
滾動(dòng)視圖
iOS 日期選擇器
iOS 警告
iOS 鏈接
視圖
圖片
列表視圖
異步存儲(chǔ)
Native UI 組件(Android)
iOS 滑塊
Map 視圖
高亮觸摸
iOS 推送通知
文本
定位
iOS 狀態(tài)欄
Native UI 組件(iOS)
在設(shè)備上運(yùn)行(Android)
Native 模塊(Android)
Flexbox
已知 Issues
iOS 選項(xiàng)卡
安裝 Android 運(yùn)行環(huán)境

ToolbarAndroid

React 組件,包裝了 Android Toolbar 小工具。工具欄可以顯示一個(gè)標(biāo)志,導(dǎo)航圖標(biāo)(如漢堡包菜單),標(biāo)題和副標(biāo)題和操作列表。標(biāo)題和子標(biāo)題被擴(kuò)展這樣以來標(biāo)志和導(dǎo)航圖標(biāo)顯示在左邊,標(biāo)題和副標(biāo)題在中間并且操作在右邊。

如果工具欄具有唯一子級(jí),它將顯示在標(biāo)題和操作之間。

例子:

    render: function() {   
      return (
        <ToolbarAndroid
          logo={require('image!app_logo')}
          title="AwesomeApp"
          actions={[{title: 'Settings', icon: require('image!icon_settings')
    show: 'always'}]}
          onActionSelected={this.onActionSelected} />
     )
    },
    onActionSelected: function(position) {
      if (position === 0) { // index of 'Settings'
     }
    }

屬性

actions [{title: string, icon: Image.propTypes.source, show: enum('always', 'ifRoom', 'never'), showWithText: bool}]

將工具欄上的可能動(dòng)作設(shè)置為動(dòng)作菜單的一部分。這些都顯示為圖標(biāo)或小部件右側(cè)的文本。如果不適合,它們將被放置在一個(gè)'溢出'菜單。

此屬性需要一個(gè)對(duì)象數(shù)組,其中每個(gè)對(duì)象具有以下鍵:

  • title:必要的, 這個(gè)操作的標(biāo)題

  • icon: 這個(gè)操作的圖標(biāo),例如: require('image!some_icon')

  • show:當(dāng)把這個(gè)操作顯示為一個(gè)圖標(biāo)或隱藏在溢出菜單中時(shí): always, ifRoomnever

  • showWithText: 布爾值,是否顯示圖標(biāo)旁邊的文本

logo Image.propTypes.source

設(shè)置工具欄的標(biāo)志。

navIcon Image.propTypes.source

設(shè)置導(dǎo)航圖標(biāo)。

onActionSelected function

被選中時(shí)調(diào)用回調(diào)函數(shù)。傳遞到回調(diào)的唯一參數(shù)是操作數(shù)組中的位置。

onIconClicked function

在選定圖標(biāo)時(shí)調(diào)用。

subtitle string

設(shè)置工具欄副標(biāo)題。

subtitleColor string

設(shè)置工具欄副標(biāo)題的顏色。

testID string

用于在端到端測(cè)試中查找此視圖。

title string

設(shè)置工具欄標(biāo)題。

titleColor string

設(shè)置工具欄副標(biāo)題的顏色。

例子

    'use strict';

    var React = require('react-native');
    var {
      StyleSheet,
      Text,
      View,
    } = React;
    var UIExplorerBlock = require('./UIExplorerBlock');
    var UIExplorerPage = require('./UIExplorerPage');

    var SwitchAndroid = require('SwitchAndroid');
    var ToolbarAndroid = require('ToolbarAndroid');

    var ToolbarAndroidExample = React.createClass({
      statics: {
      title: '<ToolbarAndroid>',
      description: 'Examples of using the Android toolbar.'
    },
    getInitialState: function() {
    return {
      actionText: 'Example app with toolbar component',
      toolbarSwitch: false,
      colorProps: {
        titleColor: '#3b5998',
        subtitleColor: '#6a7180',
       },
     };
    },
    render: function() {
    return (
      <UIExplorerPage title="<ToolbarAndroid>">
        <UIExplorerBlock title="Toolbar with title/subtitle and actions">
          <ToolbarAndroid
            actions={toolbarActions}
            navIcon={require('image!ic_menu_black_24dp')}
            onActionSelected={this._onActionSelected}
            onIconClicked={() => this.setState({actionText: 'Icon clicked'})}
            style={styles.toolbar}
            subtitle={this.state.actionText}
            title="Toolbar" />
          <Text>{this.state.actionText}</Text>
        </UIExplorerBlock>
        <UIExplorerBlock title="Toolbar with logo & custom title view (a View with Switch+Text)">
          <ToolbarAndroid
            logo={require('image!launcher_icon')}
            style={styles.toolbar}>
            <View style={{height: 56, flexDirection: 'row', alignItems: 'center'}}>
              <SwitchAndroid
                value={this.state.toolbarSwitch}
                onValueChange={(value) => this.setState({'toolbarSwitch': value})} />
              <Text>{'\'Tis but a switch'}</Text>
            </View>
          </ToolbarAndroid>
        </UIExplorerBlock>
        <UIExplorerBlock title="Toolbar with no icon">
          <ToolbarAndroid
            actions={toolbarActions}
            style={styles.toolbar}
            subtitle="There be no icon here" />
        </UIExplorerBlock>
        <UIExplorerBlock title="Toolbar with navIcon & logo, no title">
          <ToolbarAndroid
            actions={toolbarActions}
            logo={require('image!launcher_icon')}
            navIcon={require('image!ic_menu_black_24dp')}
            style={styles.toolbar} />
        </UIExplorerBlock>
        <UIExplorerBlock title="Toolbar with custom title colors">
          <ToolbarAndroid
            navIcon={require('image!ic_menu_black_24dp')}
            onIconClicked={() => this.setState({colorProps: {}})}
            title="Wow, such toolbar"
            style={styles.toolbar}
            subtitle="Much native"
            {...this.state.colorProps} />
          <Text>
            Touch the icon to reset the custom colors to the default (theme-provided) ones.
          </Text>
        </UIExplorerBlock>
      </UIExplorerPage>
    );
    },
    _onActionSelected: function(position) {
    this.setState({
      actionText: 'Selected ' + toolbarActions[position].title,
    });
    },
    });

    var toolbarActions = [
    {title: 'Create', icon: require('image!ic_create_black_48dp'), show: 'always'},
    {title: 'Filter'},
    {title: 'Settings', icon: require('image!ic_settings_black_48dp'), show: 'always'},
    ];

    var styles = StyleSheet.create({
    toolbar: {
    backgroundColor: '#e9eaed',
    height: 56,
    },
    });

    module.exports = ToolbarAndroidExample;
上一篇:輔助功能下一篇:不透明觸摸