开发者

ListView and ListActivity

开发者 https://www.devze.com 2023-03-13 21:48 出处:网络
I have a program for Android do I need to modify my activity to be a ListActivity to use a ListView or can开发者_Go百科 I just leave it as a regular activity?

I have a program for Android do I need to modify my activity to be a ListActivity to use a ListView or can开发者_Go百科 I just leave it as a regular activity?

Thanks in advance.


You should extend your activity to make it a ListActivity.

Among the reasons is the fact that you get the onListItemClick() method which is called whenever you click a item which saves you from creating a listener.

Besides, you don't lose anything, if you want to change the layout of a ListActivity you still can with setContentView() method from Activity.


The answer to your question is NO.

You do not NEED to use ListActivity.

You can easily add a ListView to a regular Activity.

0

精彩评论

暂无评论...
验证码 换一张
取 消