如何更改只有第一个元素的文本颜色?
答
为您的微调项目制作一个自定义XML文件。
spinner_item.xml:
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="20sp"
android:gravity="left"
android:textColor="#FF0000"
android:padding="5dip"
/>
现在使用此文件来显示你的微调的项目,如:
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.spinner_item,list);
你需要设置自定义spinner_item布局。显示你试过的东西 –
@ShivanshSaxena无论你已经尝试过什么,或者你现在想要包括那些代码。 –
请点击此链接:https://*.com/questions/44513126/spinner-background-color-with- dropdowndown-icon/44513290#44513290 –