工作代码: https://github.com/lukeallison/ViewPagerMasterDetail
Android Master/Detail Flow 模板: http://developer.android.com/tools/projects/templates.html#master-detail-activity
说明:使用 Android Studio 中可用的 Master/Detail Flow 模板,我的应用程序利用 ViewPager 来管理三个 Parent 片段.第三个片段是 Master(列表),其中有一个 Child(详细)片段.
Description: Using the Master/Detail Flow template available in Android Studio, my application utilizes a ViewPager to manage three Parent fragments. The third fragment is a Master (list), which has a Child (detail) fragment.
问题:
android:configChanges="orientation|keyboardHidden|screenSize"
以便子(细节)片段在旋转时膨胀正确的布局.我不想强制执行此操作.请帮助修复此错误.android:configChanges="orientation|keyboardHidden|screenSize"
in order for the Child (detail) fragment to inflate the correct layout when rotated. I'd like to not have to enforce this. PLEASE help fix this bug.请帮我修复这些错误,以便我们有一个我自己和其他人都可以使用的模板.
Please help me fix these bugs so we have a template that myself and others can use.
Bug 修复.fragment_item_list.xml 中的列表现在在初始和后续布局膨胀时显示列表的最后一个元素.我将 <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
添加到 style.xml 和 ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
到 ItemListFragment.java 的 initLayout 方法.
Bug fix. The List in fragment_item_list.xml now displays the last element of the List on initial and subsequent layout inflation. I added <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
to style.xml and ((AppCompatActivity)getActivity()).setSupportActionBar(toolbar);
to the initLayout method of ItemListFragment.java.
这篇关于在 ViewPager Fragments 中使用 Master/Detail 模板(下载链接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!