create Fragment without list pane in Android
-
13-11-2019 - |
Question
I am working on a Fragment application in Android 2.2. It so happens that most examples have a list on the left side that opens up a detail page when clicked.
However, does anyone know if this is by default or I can have something else other than a list like take for instance button widgets?
Thanks in advance.
Solution
Yes, you can have something else there. Note that to have the list you need to extend the ListFragment. So you have two choices:
- Extend Fragment and do what you want. This is good if what you want does not fit into the List ideology at all.
- Extend ListFragment and use a custom Adapter. Then you can reimplement Adapter.getView and draw whatever widget you want, including the buttons.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow