我建立一个Android应用程序,我试图让它使用程序兼容性
库API级别10兼容。正常的活动都没有问题,但使用的是什么曾经是 ListActivity
(现从 ActionBarActivitity
扩展),我得到的问题时, setListAdapter(适配器)
等的ListView
有关的方法。
I am building an Android app and I am trying to make it compatible with API level 10 using AppCompat
library. Normal activities are no problem but when using what used to be ListActivity
(now extends from ActionBarActivitity
) I am getting problems with setListAdapter(adapter)
and other ListView
related methods.
我能做些什么让我的 ListActivitity
要与程序兼容性
What can I do to make my ListActivitity
to be compatible with AppCompat
?
从支持库的http://developer.android.com/reference/android/support/v4/app/ListFragment.html
Use a ListFragment
from the support library http://developer.android.com/reference/android/support/v4/app/ListFragment.html
您可以使用 AppCompact
并延长 ActionBarActivity
。在 ListFragment
您可以使用 setListAdapter(适配器)
。
You can use AppCompact
and extend ActionBarActivity
. In ListFragment
you can use setListAdapter(adapter)
.
如果你不想 ListFrament
你可以有一个列表视图
在活动布局,布局设置为活动中,初始化它的活动,并设置适配器的ListView
。
If you don't want ListFrament
you can have a Listview
in activity layout, set the layout to the activity, initialize it in Activity and set adapter to ListView
.