ud_an
ud_an

Reputation: 4921

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,

Image

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);

Upvotes: 0

Views: 5035

Answers (1)

ud_an
ud_an

Reputation: 4921

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

Upvotes: 5

Related Questions