我有一个 Activity 和一个 xml,我想在我拥有的 listAdapter 中放置一个图像。
我的xml:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:gravity="center_vertical|center_horizontal"
android:padding="15dp"
android:textSize="18sp"
android:textStyle="italic" >
</TextView>
我在 Activity 中的 listAdapter:
String adapter[] = new String[1];
adapter[0] = "Test";
setListAdapter(new ArrayAdapter<String>(this, R.layout.activity_main, adapter));
这只是代码的一部分,实际上我有一个 for() 在列表中制作了很多行,我的想法是在哪一行中放置具有不同颜色的图像,例如根据哪一行中的值的标签。那可能吗?谢谢你。