How to create a ListFragment (of the support v4 library) layout from xml?
ListFragment
sets up its layout programmatically, so if you want to modify it, you need to mess with add/remove view.
相关问题
- How can I create this custom Bottom Navigation on
- Illegal to have multiple roots (start tag in epilo
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Creating XML Elements without namespace declaratio
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Get Attribute Value From Simple XML Using JQuery /
From the android sdk (ListFragment) (http://developer.android.com/reference/android/app/ListFragment.html):
So when you want your own layout.xml for a FragmentList overide onCreateView and inflate your own layout.
For example:
Create a android layout (yourlistlayout.xml) and put the following xml on the position where you want to show your ListFragment.
in your ListFragment class put the following code:
I've converted the created layout to xml, you can add/remove your widgets or e.g. add
pulltorefresh
solutions. You shouldn't change the needed ids. Because of internal ids needed for some of the widgets an helper function needs to be called and it needs to be in support v4 namespace since constants are internal with default visibility.list_loader.xml
and the class
ListFragmentLayout
inandroid.support.v4.app
(in your project, you don't need to modify support v4 jar)in your fragment that extends
ListFragment