我无法设计它.几乎没有任何关于此的文件.我想知道如何设置fontFamily.如何在Picker.items上设置背景颜色?
https://facebook.github.io/react-native/docs/picker.html
设置fontFamily或背景颜色不起作用.将它包装在View中并将样式属性赋予View也不起作用.
<Picker
style={styles.picker} // cannot set fontFamily here
selectedValue={this.state.selected2}
onValueChange={this.onValueChange.bind(this, 'selected2')}
mode="dropdown">
<Item label="hello" value="key0" /> // cannot set backgroundColor here
<Item label="world" value="key1" />
</Picker>
Run Code Online (Sandbox Code Playgroud) 我正在为我的应用程序使用appcompat主题.需要知道我如何显示下划线到微调器.它只是显示锚.我尝试使用android:background设置下划线但它会使锚点消失.
这是我的微调器代码:
Spinner food = (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<CharSequence> foodadapter = ArrayAdapter.createFromResource(
this, R.array.item_array, android.R.layout.simple_spinner_item);
foodadapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
food.setAdapter(foodadapter);
Run Code Online (Sandbox Code Playgroud)
这是我描述微调器的布局文件的一部分:
<Spinner
android:id="@+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/textView1" />
Run Code Online (Sandbox Code Playgroud)
这是item_array:
<resources>
<string name="item_picker">Select an iten</string>
<string-array name="item_array">
<item>Pizza</item>
<item>Burger</item>
<item>Sandwiches</item>
<item>Bread</item>
<item>Pastries</item>
<item>Snackers</item>
</string-array>
</resources>
Run Code Online (Sandbox Code Playgroud)
注意:我不想要simple_spinner_dropdown_item.
我只想增加尺寸.我怎样才能做到这一点?
我<Text/>在iOS中遇到了React-Native 组件的奇怪问题.
我想将borderBottomWidth样式应用到<Text/>组件中,但它不起作用.但是,该borderWidth选项有效.
工作
<Text style={{borderWidth:1}}> React Native </Text>
没工作
<Text style={{borderBottomWidth:1}}> React Native </Text>
有没有办法只将底层边框应用到<Text/>组件中?
谢谢!
注意:
我知道以下提到的方法是为了实现这一点,但在我的情况下,我需要将样式仅应用于<Text/>组件.
<View/>到<Text/>和应用borderBottomWidth样式的<View/>.(borderBottomWidth工作正常<View/>)<View/>下面的<Text/>内容添加到可能看起来像一条线的组件中. 有没有办法在用户点击之前显示反应原生选择器的占位符.我们的想法是拥有一个说"国籍"的选择器,一旦你点击并选择你所在的国家,它就会呈现国家.我想这样做,而没有"国籍"作为选择器中的可用选项.