Java 在listview中不可见的文本

Java 在listview中不可见的文本,java,android,listview,Java,Android,Listview,我的listview没有显示数组中的文本,我认为文本在某种程度上是透明的,但我不知道如何更改它,使其显示为黑色文本 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_level_one); ListView levelOneListView = findView

我的listview没有显示数组中的文本,我认为文本在某种程度上是透明的,但我不知道如何更改它,使其显示为黑色文本

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_level_one);
    ListView levelOneListView = findViewById(R.id.levelOneListView);

    String[] easyList = new String[]{
             "Daisy", "Dandelion", "Grass", "Rock", "Tree", "Postbox"
    };
    ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String> (this, android.R.layout.simple_list_item_checked, easyList);
    levelOneListView.setAdapter(arrayAdapter);




}
@覆盖
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity\u level\u one);
ListView levelOneListView=findViewById(R.id.levelOneListView);
字符串[]easyList=新字符串[]{
“雏菊”、“蒲公英”、“草”、“岩石”、“树”、“邮箱”
};
ArrayAdapter ArrayAdapter=新的ArrayAdapter(这个,android.R.layout.simple\u list\u item\u选中,easyList);
setAdapter(arrayAdapter);
}
}

我尝试将文本颜色更改为多种不同的颜色,但在listview中没有一种颜色可见

<ListView
    android:id="@+id/levelOneListView"
    android:layout_width="395dp"
    android:layout_height="match_parent"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginTop="60dp"
    android:layout_marginEnd="8dp"
    android:layout_marginRight="8dp"
    android:layout_marginBottom="8dp"
    android:cacheColorHint="#0A0A0A"
    android:textColor="@android:color/black"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView2" />

当我运行模拟器时,它将显示复选框,但不会显示实际文本

<ListView
    android:id="@+id/levelOneListView"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginTop="60dp"
    android:layout_marginEnd="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginBottom="8dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView2" />

@覆盖
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity\u level\u one);
ListView levelOneListView=findViewById(R.id.levelOneListView);
字符串[]easyList=新字符串[]{
“雏菊”、“蒲公英”、“草”、“岩石”、“树”、“邮箱”
};
ArrayAdapter ArrayAdapter=新的ArrayAdapter(这是android.R.layout.simple\u list\u item\u 1,easyList);
setAdapter(arrayAdapter);
levelOneListView.notifyDatasetChanged()
}

属性
textColor
没有影响。请您的问题提供相关代码,您在哪里设置
列表视图
及其
适配器
。提供一些代码,您如何填充列表视图?好的,您已经正确设置了
适配器
,因为您正在为
上下文使用
活动
;i、 例如,
这个
参数。这意味着
列表视图
项目将遵循
活动
上设置的主题,默认主题将具有对比背景和文本颜色。您是否在
活动\u level\u one
中为
的父级设置了自己的背景色?或者你有没有可能在
活动
的主题中摆弄颜色?也就是说,您是否修改了
res/
文件夹中的任何颜色或属性值?我确实将其更改为没有任务栏,但为了纠正问题将其更改回原来的状态。您是否在
的父级设置了
背景
属性,即
周围的
,在
活动
中?根据您的描述,听起来您当前的背景很浅,因此如果您在
上设置
android:background=“#000000”
,作为测试,会发生什么情况?你能看到你的文字吗?这似乎没有解决它