在ViewPager片段使用主/从模板(下载链接) [英] Using the Master/Detail template in ViewPager Fragments (download link)

查看:238
本文介绍了在ViewPager片段使用主/从模板(下载链接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

工作code: https://github.com/lukeallison/ViewPagerMasterDetail

Android的主/从流模板: http://developer.android.com/tool​​s/projects/templates.html#master-detail-activity

说明:使用Android Studio中可用的主/详细信息流模板,我的应用程序利用ViewPager来管理三个父片段。第三个片段是硕士(列表),其中有一个孩子(详细)片段。

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.

问题:


  1. 当fragment_item_list第一次充气应用栏按下屏幕范围下面的列表中的最后一项。这个问题已经不再旋转设备后,present。只需添加填充到屏幕底部会的的解决这个问题,因为它会转动离开后在屏幕底部的多余的空格。众多的SO线程都未能解决这一问题。 - 固定

  2. 要求的android:configChanges =方向| keyboardHidden |屏幕尺寸为了儿童(细节)片段旋转时膨胀正确的布局。我想没有执行这项。请帮助解决这个bug。

  3. 使用德precated setOnPageChangeListener和onAttach(活动)

  4. 升级依赖关系23.2.0导致ItemListFragment未能膨胀正确的片段旋转,所以我不能更新应用程序的库时

  5. 的code可能比必要
  6. 更繁琐
  1. When fragment_item_list is first inflated the App Bar pushes the last item of the list below the bounds of the screen. This issue is no longer present after rotating the device. Simply adding padding to the bottom of the screen will not fix the issue as it will leave an unwanted space at the bottom of the screen after rotating. Numerous SO threads have failed to address this issue. - Fixed
  2. Requires 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.
  3. Uses deprecated setOnPageChangeListener and onAttach(Activity)
  4. Upgrading the dependencies to 23.2.0 results in the ItemListFragment failing to inflate the correct Fragment when rotated so I can't update the libraries in the application
  5. The code is probably more cumbersome than necessary

请帮我修复这些错误,所以我们有自己和其他人可以使用的模板。

Please help me fix these bugs so we have a template that myself and others can use.

推荐答案

Bug修复。在fragment_item_list.xml列表现在显示在初始和后续布局通胀名单的最后一个元素。我加了<样式名称=AppTheme父=Theme.AppCompat.Light.NoActionBar> 来style.xml和((AppCompatActivity )getActivity())setSupportActionBar(工具栏); 来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片段使用主/从模板(下载链接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆