java.lang.RuntimeException: Your content must have a ListView whose id attribute is 'android.R.id.list'

后端 未结 4 1875
不思量自难忘°
不思量自难忘° 2020-12-10 15:31

I know that there has been simialr questions but I can\'t make it work even though I look at those. The error message is:

java.lang.RuntimeException:

4条回答
  •  时光说笑
    2020-12-10 15:47

    Change your ListView in XML to have the following id:

    
    

    It's a requirement of using ListFragment/SherlockListFragment

    http://developer.android.com/reference/android/app/ListFragment.html

    ListFragment has a default layout that consists of a single list view. However, if you desire, you can customize the fragment layout by returning your own view hierarchy from onCreateView(LayoutInflater, ViewGroup, Bundle). To do this, your view hierarchy must contain a ListView object with the id "@android:id/list" (or list if it's in code)

提交回复
热议问题