文本颜色不可见

时间:2011-09-02 04:38:08

标签: android

我有一个白色背景的列表视图。我已将黑色设为文本颜色。问题是,如果你点击它就可以阅读列表视图中的文字,但只要你再次按住它就会再次显示为白色

这是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>

这是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  `ArrayAdapter<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 个答案:

没有答案