• <legend id='gJWvE'><style id='gJWvE'><dir id='gJWvE'><q id='gJWvE'></q></dir></style></legend>
  • <tfoot id='gJWvE'></tfoot>

    <small id='gJWvE'></small><noframes id='gJWvE'>

      <i id='gJWvE'><tr id='gJWvE'><dt id='gJWvE'><q id='gJWvE'><span id='gJWvE'><b id='gJWvE'><form id='gJWvE'><ins id='gJWvE'></ins><ul id='gJWvE'></ul><sub id='gJWvE'></sub></form><legend id='gJWvE'></legend><bdo id='gJWvE'><pre id='gJWvE'><center id='gJWvE'></center></pre></bdo></b><th id='gJWvE'></th></span></q></dt></tr></i><div id='gJWvE'><tfoot id='gJWvE'></tfoot><dl id='gJWvE'><fieldset id='gJWvE'></fieldset></dl></div>

      • <bdo id='gJWvE'></bdo><ul id='gJWvE'></ul>

        在 ViewPager Fragments 中使用 Master/Detail 模板(下载链接)

        时间:2023-10-04
          <i id='l6maj'><tr id='l6maj'><dt id='l6maj'><q id='l6maj'><span id='l6maj'><b id='l6maj'><form id='l6maj'><ins id='l6maj'></ins><ul id='l6maj'></ul><sub id='l6maj'></sub></form><legend id='l6maj'></legend><bdo id='l6maj'><pre id='l6maj'><center id='l6maj'></center></pre></bdo></b><th id='l6maj'></th></span></q></dt></tr></i><div id='l6maj'><tfoot id='l6maj'></tfoot><dl id='l6maj'><fieldset id='l6maj'></fieldset></dl></div>
            <bdo id='l6maj'></bdo><ul id='l6maj'></ul>
              <tbody id='l6maj'></tbody>
          • <legend id='l6maj'><style id='l6maj'><dir id='l6maj'><q id='l6maj'></q></dir></style></legend>

          • <small id='l6maj'></small><noframes id='l6maj'>

                  <tfoot id='l6maj'></tfoot>

                • 本文介绍了在 ViewPager Fragments 中使用 Master/Detail 模板(下载链接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  工作代码: 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.

                  问题:

                  1. 当 fragment_item_list 首次膨胀时,应用栏会将列表的最后一项推到屏幕边界下方.旋转设备后,此问题不再存在.只需在屏幕底部添加填充不会解决问题,因为它会在旋转后在屏幕底部留下不需要的空间.许多 SO 线程未能解决此问题.- 已修复
                  2. 需要 android:configChanges="orientation|keyboardHidden|screenSize" 以便子(细节)片段在旋转时膨胀正确的布局.我不想强制执行此操作.请帮助修复此错误.
                  3. 使用已弃用的 setOnPageChangeListener 和 onAttach(Activity)
                  4. 将依赖项升级到 23.2.0 会导致 ItemListFragment 在旋转时无法膨胀正确的 Fragment,因此我无法更新应用程序中的库
                  5. 代码可能比必要的更繁琐
                  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 中的列表现在在初始和后续布局膨胀时显示列表的最后一个元素.我将 <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 模板(下载链接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:ViewPager:java.lang.IllegalArgumentException:pointerIndex 超出 下一篇:Android 2 ViewPagers 同时滚动

                  相关文章

                    <tfoot id='NEVEm'></tfoot>
                      <bdo id='NEVEm'></bdo><ul id='NEVEm'></ul>
                  1. <legend id='NEVEm'><style id='NEVEm'><dir id='NEVEm'><q id='NEVEm'></q></dir></style></legend>

                      <small id='NEVEm'></small><noframes id='NEVEm'>

                    1. <i id='NEVEm'><tr id='NEVEm'><dt id='NEVEm'><q id='NEVEm'><span id='NEVEm'><b id='NEVEm'><form id='NEVEm'><ins id='NEVEm'></ins><ul id='NEVEm'></ul><sub id='NEVEm'></sub></form><legend id='NEVEm'></legend><bdo id='NEVEm'><pre id='NEVEm'><center id='NEVEm'></center></pre></bdo></b><th id='NEVEm'></th></span></q></dt></tr></i><div id='NEVEm'><tfoot id='NEVEm'></tfoot><dl id='NEVEm'><fieldset id='NEVEm'></fieldset></dl></div>