不能改变颜色OD微调分 [英] Can't change the color od spinner divider
问题描述
我的飞旋的定义是这样的,它似乎机器人:分=#66BC31没有任何影响,我仍然得到白色分频器:
My spinner is defined like this and it seems android:divider="#66BC31" has no effect, i still get white divider:
<Spinner
android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="15dip"
android:layout_marginBottom="15dip"
android:layout_marginLeft="10dip"
android:layout_marginRight="10dip"
android:textColor="#ffffff"
android:divider="#66BC31"
android:background="@drawable/spina" />
这是我的code,其中我改变我的飞旋的字体和选择资源的下拉列表:
This is my code where i change my spinner font and select resource for dropdown:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(Roaming.this,
R.layout.roaming_spinner, data) {
public View getView(int position, View convertView, ViewGroup parent) {
View v = super.getView(position, convertView, parent);
Typeface externalFont = Typeface.createFromAsset(getAssets(),
"fonts/HelveticaNeueLTCom-Lt.ttf");
((TextView) v).setTypeface(externalFont);
return v;
}
public View getDropDownView(int position, View convertView,
ViewGroup parent) { // we need this so we can use custom
// font for spinner (open)
View v = super.getDropDownView(position, convertView, parent);
Typeface externalFont = Typeface.createFromAsset(getAssets(),
"fonts/HelveticaNeueLTCom-Lt.ttf");
((TextView) v).setTypeface(externalFont);
return v;
}
};
adapter.setDropDownViewResource(R.layout.roaming_spinner_row);
我也尝试添加行的android:分=#66BC31来roaming_spinner_row.xml和roaming_spinner.xml那里文字大小和颜色我没有成功关闭和打开微调的声明,并再次
I also tried adding line android:divider="#66BC31" to roaming_spinner_row.xml and roaming_spinner.xml where text size and color for my closed and opened spinner are declared and again with no success.
推荐答案
我终于找到了答案,这要归功于<一个href=\"http://stackoverflow.com/questions/1918468/android-spinner-how-to-make-dropdown-view-transparent/7047187#7047187\">this链接和一些更多的研究。
I finally found the answer, thanks to this link and some more research.
您所要做您的活动的主题是定义
What you have to do is define in your activity's theme
<item name="android:dropDownListViewStyle">@style/App.Style.Spinner</item>
,然后创建适当的风格
and then create the proper style with
<style name="App.Style.Spinner" parent="@style/Widget.Sherlock.Light.ListView.DropDown">
<item name="android:dividerHeight">10dip</item>
<item name="android:divider">@drawable/mydivider</item>
</style>
这篇关于不能改变颜色OD微调分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!