I found the below documentation on how to set a customView
. But when I change the id
in my layout to "text1" and "icon",
You need to use the system Resource identifiers. That is, @android:id/text1
and @android:id/icon
.
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:id="@android:id/icon"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:id="@android:id/text1"
android:gravity="center"
android:layout_below="@android:id/icon" />
If you would need to reference these IDs in your code, they would be android.R.id.text1
and android.R.id.icon
.