开发者

Is it possible to have a ListView in a Fragment - or a ListFragment in a Fragment?

In my application I want a panel that contains some text information then below it a list of menu items. What is the best way to do this?

Is it possible to have a ListView within the fragment along with other TextView's etc.

If not is it possible to have a ListFragment within a Fragment? That is what I am attempting at the moment but when I try and run it I get an error:

java.lang.IllegalStateException: Fragment LeftMenuFra开发者_运维问答gment{4089c090} not attached to Activity


Yes you can have listview in a fragment. Like ListActivty there is Listfragment which you can use for using ListView in your application.

See this market tutorial for help


The answer is 'Yes' we can have a listview in fragment. The error is self explanatory. You hav not added it to the activity or any layout.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜