fragment1.xml
<RelativeLayout 
	xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:paddingBottom="0dp"
    android:paddingLeft="30dp"
    android:paddingRight="0dp"
    android:paddingTop="0dp" >
        
    <ExpandableListView
       	android:id="@+id/expListView"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:paddingLeft="5dp"
        android:paddingTop="5dp"
        android:background="#003060"
   		android:layout_width="match_parent"
   		android:layout_height="wrap_content"
   		android:clickable="true"
   		android:dividerHeight="3dp" />
</RelativeLayout>
When using ExpandableListView, if the inheritance of the class that implements the fragment is ** ListFragment **,
fragment1.java
public class Fragment1  extends ListFragment {
** onViewCreated ** throws a ** RuntimeException **. (To be exact, an exception is thrown in the superclass, that is, onViewCreated of ListFragment)
 "Content has view with id attribute 'android.R.id.list' that is not a ListView class"
To avoid this, make the inheritance ** Fragment ** instead of ListFragment.
fragment1.java
public class Fragment1  extends Fragment {
        Recommended Posts