Change text color Spinner Item showing
I have used simple cursor adapter to set adapter for spinner as i have used sqlite databse. but i am not able to customize the font color of the spinner,
Imag开发者_如何学Goe
Here is the Url of the my spinner has dark red background i want to change text color to white using simple cursor adapter with spinner android
code :
Cursor cursor = dbAdapter.getAllData();
if(cursor.getCount()>0){
String[] from = new String[]{"columm_name"};
// create an array of the display item we want to bind our data to
int[] to = new int[]{android.R.id.text1};
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this, android.R.layout.simple_spinner_item, cursor, from, to);
mAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spinnerName.setAdapter(mAdapter);
solution to my question hope it will help others.
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1" style="?android:attr/spinnerItemStyle"
android:singleLine="true" android:layout_width="fill_parent"
android:layout_height="wrap_content" android:ellipsize="marquee" android:textColor="#ffffff"/>
just give this textview android simple cursor adapter in place of android.R.layout.simple_spinner_item
精彩评论