相关疑难解决方法(0)

Android ListView文字颜色

我试图将ListView textColor设置为黑色,因为我使用的是白色背景.

这是我的MailActivity

public class MailActivity extends ListActivity {

    String[] listItems = { "Compose", "Inbox", "Drafts", "Sent" };

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(R.layout.mails);

        setListAdapter(new ArrayAdapter(this,
                android.R.layout.simple_list_item_1, listItems));

    }
}
Run Code Online (Sandbox Code Playgroud)

和我的XML

<?xml version="1.0" encoding="utf-8"?>
<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">

    <ListView 
        android:id="@android:id/list" 
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"/>

    <TextView 
        android:id="@android:id/empty" 
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" 
        android:text="Empty set" 
        android:textColor="#000000" />

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我将背景设为白色,但不确定将前景设置为黑色.我试过xml,看起来没有帮助.

android listview

49
推荐指数
3
解决办法
21万
查看次数

标签 统计

android ×1

listview ×1