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

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

    <legend id='lmIdH'><style id='lmIdH'><dir id='lmIdH'><q id='lmIdH'></q></dir></style></legend>

        将视图渲染到 View Pager - 优化方式

        Rendering Views to View Pager - Optimized Way(将视图渲染到 View Pager - 优化方式)

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

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

                  本文介绍了将视图渲染到 View Pager - 优化方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  在我的应用程序中,我使用以下方法将视图呈现/生成到视图寻呼机.是的,它工作正常,符合预期.

                  In my application I am using the following means to render/generate the views to a view pager. Yes it works fine and as expected.

                  注意:- 但在这里我看到这种方法必须在 Android 资源(与设备相关联)方面付出很多努力.我想找出任何优化的方法来做同样的事情.有吗?建议我还是上面的好?

                  class MyActivity extends Activity{
                          @Override
                          public void onCreate(Bundle savedInstanceState) {
                  
                               super.onCreate(savedInstanceState);
                              setContentView(R.layout.layoutView);
                  
                              LinearLayout pageFirst = getPageFisrt(context);
                              LinearLayout pageSecond = getPageSecond(context);
                              LinearLayout pageThird = getPageThird(context);
                              LinearLayout pageFourth = getPageFourth(context);
                              .........
                              .........
                  
                              pageArrayList = new ArrayList<LinearLayout>();
                              pageArrayList.clear();
                  
                              pageArrayList.add(pageFirst);
                              pageArrayList.add(pageSecond);
                              pageArrayList.add(pageThird);
                              pageArrayList.add(pageFourth);
                              ...........
                              ..........
                  
                              viewPager.setAdapter(new MatchDetailsPagerAdapter(
                                      context, pageArrayList));
                  
                              indicator.setViewPager(viewPagerMatchDetailMain);
                  
                          }
                  
                      }
                  

                  对于每个页面,我都从资源中扩充了布局,喜欢

                  and for each page I inflated the layout from resource, like

                     private LinearLayout getPageFisrt(Context context) {
                          // TODO Auto-generated method stub
                          LayoutInflater inflater = LayoutInflater.from(context);
                          LinearLayout linearLayoutFirstPage = (LinearLayout) inflater.inflate(
                                  R.layout.pager_first_large_views, null);
                  
                         // performing action on the page child layout.
                  
                          return linearLayoutFirstPage;
                      }
                  

                  期待更好的方法来做同样的事情

                  推荐答案

                  我想,用FragmentPagerAdapter更优化的片段,然后在onCreate方法中生成所有layot.

                  I think,to use fragments with FragmentPagerAdapter more optimized ,then generate all layots in onCreate method.

                  public class FragmentAdapter extends FragmentPagerAdapter
                      implements IconPagerAdapter
                  {    
                      private int count = 2;
                  
                      public InstallFragmentAdapter(FragmentManager fm) {
                          super(fm);
                      }
                  
                      @Override
                      public Fragment getItem(int position) {     
                          switch (position) {
                              case 0:
                                  return Fragment0.newInstance();
                              case 1:
                                  return Fragment1.newInstance();
                              case 2:
                                  return Fragment2.newInstance();
                              default:
                                  break;
                          }
                          return null;
                      }
                  
                      @Override
                      public int getCount() {
                          return count;
                      }
                  
                      @Override
                      public CharSequence getPageTitle(int position) {
                          return "";
                      }
                  
                      @Override
                      public int getIconResId(int position) {
                          return 0;
                      }
                  }
                  

                  这篇关于将视图渲染到 View Pager - 优化方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How can I use CClistview in COCOS2d Android?(如何在 COCOS2d Android 中使用 CClistview?)
                  cocos2d-android: how to display score(cocos2d-android:如何显示分数)
                  Sqlite database not copied from asset folder Android(Sqlite 数据库未从资产文件夹 Android 复制)
                  SQLite Database Copy Appears Corrupted When Generated by Device and not Emulator(SQLite 数据库副本在由设备而不是模拟器生成时出现损坏)
                  Android file copy(安卓文件拷贝)
                  Android how to detect Copy event of Edittext in android(Android如何在android中检测Edittext的Copy事件)
                  • <small id='hCbyV'></small><noframes id='hCbyV'>

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