开发者

The text color is not visible

开发者 https://www.devze.com 2023-04-01 05:57 出处:网络
I have a listview with a white background. I already set black as its text color. The problem is, you can only read the text in the list view if you click on it but as soon as you relase the hold on i

I have a listview with a white background. I already set black as its text color. The problem is, you can only read the text in the list view if you click on it but as soon as you relase the hold on it it'll be plain white again

here's the xml:

<LinearLayout
  xmlns:android="http://schemas.android.com/apk/res/android"
  android:orientation="vertical"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:background="#FFFFFF">
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:background="#F7EFE8"> 
        <TextView 
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:text="SETTINGS"
            android:textStyle="bold"
            android:textColor="@android:color/black"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"/>
    </LinearLayout>
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:textColor="@android:color/black">
        <TextView  
            android:id="@+id/selection"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content" 
            android:textColor="@android:color/black"/>
        <ListView 
            android:id="@+android:id/list"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:drawSelectorOnTop="false"
            android:textColor="@android:color/black"/>
    </LinearLayout>
</LinearLayout>

and here's the java:

public class SettingsActivity extends ListActivity {
    TextView selection;
    String[] items={"Change Password", "Save Credentials" };

    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.settingsactivity);

        setListAdapter(new  `ArrayAd开发者_如何学JAVAapter<String>(this,android.R.layout.simple_list_item_multiple_choice,items));`
            selection =(TextView)findViewById(R.id.selection);
    }

    public void onListItemClick(ListView parent, View v, int position, long id) {
        selection.setText(items[position]);
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消