Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/195.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';t在android中更改listview的文本大小和文本颜色_Android_Android Listview - Fatal编程技术网

Can';t在android中更改listview的文本大小和文本颜色

Can';t在android中更改listview的文本大小和文本颜色,android,android-listview,Android,Android Listview,我想更改listview的textsize和textcolor。我愿意: +我在文件夹布局中创建新的xml文件(mytext.xml): <?xml version="1.0" encoding="utf-8"?> <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" android:pa

我想更改listview的textsize和textcolor。我愿意: +我在文件夹布局中创建新的xml文件(mytext.xml):

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android" 
          android:id="@android:id/text1"  
          android:paddingTop="2dip" 
          android:paddingBottom="3dip" 
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" /> 

我改变了:

adapter = new ArrayAdapter<String> (this,android.R.layout.mytext,HistoryList);
adapter=newarrayadapter(这个,android.R.layout.mytext,HistoryList);
但是eclipse找不到mytext.xml?

adapter=newArrayAdapter(这个,android.R.layout.mytext,HistoryList);
adapter = new ArrayAdapter<String> (this, android.R.layout.mytext, HistoryList);

在上行中,
ArrayAdapter
的第二个参数应该是R.layout.mytext,而不是android.R.layout.mytext

如果代码中的所有内容都正确,则转到“项目”菜单并清理项目。但在做这件事之前,要确保一切正常。否则,您可能会从gen文件夹“android.R.layout.mytext”中丢失R.java文件。此行应为“R.layout.mytext”@用户1609578发布您的完整代码,您是否使用自定义listview?您可以在谷歌上搜索颜色代码。您可以在mytext.xml中使用android:textsize属性更改textview的文本大小,并使用android:textcolor属性更改textview的颜色。