Is it possible to customize a custom ListView in a ListFragment?
2 answers
From information pulled from Android SDK: Using a custom view in XML layout , it is easy to answer your question:
In your layout xml file, instead of using "ListView" just put the name (with packages) in the xml file. Example:
Before:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/list_background"
android:layout_weight="1" />
<TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/no_data_list_background"
android:text="No data" />
</LinearLayout>
After:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.mycompany.BounceListView android:id="@id/android:list"
android:layout_width="match_parent"
android:layout_height="0dp"
android:background="@color/list_background"
android:layout_weight="1" />
<TextView android:id="@id/android:empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/no_data_list_background"
android:text="No data" />
</LinearLayout>
0
source to share