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

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

      1. <small id='x8Yzn'></small><noframes id='x8Yzn'>

      2. 拉动刷新和加载更多列表视图,如 facebook

        pull to refresh and loadmore listview like facebook(拉动刷新和加载更多列表视图,如 facebook)
          <bdo id='B7Ers'></bdo><ul id='B7Ers'></ul>
          <i id='B7Ers'><tr id='B7Ers'><dt id='B7Ers'><q id='B7Ers'><span id='B7Ers'><b id='B7Ers'><form id='B7Ers'><ins id='B7Ers'></ins><ul id='B7Ers'></ul><sub id='B7Ers'></sub></form><legend id='B7Ers'></legend><bdo id='B7Ers'><pre id='B7Ers'><center id='B7Ers'></center></pre></bdo></b><th id='B7Ers'></th></span></q></dt></tr></i><div id='B7Ers'><tfoot id='B7Ers'></tfoot><dl id='B7Ers'><fieldset id='B7Ers'></fieldset></dl></div>

            1. <legend id='B7Ers'><style id='B7Ers'><dir id='B7Ers'><q id='B7Ers'></q></dir></style></legend>
              • <tfoot id='B7Ers'></tfoot>

                  <tbody id='B7Ers'></tbody>

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

                1. 本文介绍了拉动刷新和加载更多列表视图,如 facebook的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我在这里使用滑动抽屉.在点击 主页图标 时,它会显示 3 个标签
                  1) 我应该为标签申请哪个概念?
                  2) 我想像 facebook 一样在 listview 中应用 pulltorefereshloadmore 吗?因为您还看到,当向上滚动时,进度条会隐藏并请求取消.

                  here i am using sliding drawer. in that on click home icon it shows 3 tabs
                  1) which concept should i apply for tab ?
                  2) I want to apply pulltoreferesh and loadmore in listview like facebook ? in that you have also seen that when scrolling up progressbar gets hide and request get cancel.

                  推荐答案

                  public class ListDemo extends Fragment{
                      ArrayAdapter<String> files;
                      private LinkedList<String> mListItems;
                      PullAndLoadListView lyt ;
                      //  ListView lv1;
                  
                      // The data to be displayed in the ListView
                      private String[] mNames = { "Fabian", "Carlos", "Alex", "Andrea", "Karla",
                              "Freddy", "Lazaro", "Hector", "Carolina", "Edwin", "Jhon",
                              "Edelmira", "Andres" };
                  
                      // The data to be displayed in the ListView
                      private String[] mAnimals = { "Perro", "Gato", "Oveja", "Elefante", "Pez",
                              "Nicuro", "Bocachico", "Chucha", "Curie", "Raton", "Aguila",
                              "Leon", "Jirafa" };
                  
                  
                  
                      public View onCreateView(LayoutInflater inflater, ViewGroup container,
                              Bundle savedInstanceState) {
                          super.onCreateView(inflater, container, savedInstanceState);
                          final View v = inflater.inflate(R.layout.tab_frag3_layout, container, false);
                          mListItems = new LinkedList<String>();
                          mListItems.addAll(Arrays.asList(mNames));
                          lyt = (PullAndLoadListView)v.findViewById(R.id.tab_frag3_listview1);
                  
                          if (container == null) {
                              return null;
                          }
                  
                          files = new ArrayAdapter<String>(getActivity(),android.R.layout.simple_list_item_1,mListItems);
                          lyt.setAdapter(files);
                          lyt.setOnRefreshListener(new OnRefreshListener() {
                  
                              @Override
                              public void onRefresh() {
                                  // TODO Auto-generated method stub
                                  new PullToRefreshDataTask().execute();
                              }
                          });
                          lyt.setOnLoadMoreListener(new OnLoadMoreListener() {
                  
                              @Override
                              public void onLoadMore() {
                                  // TODO Auto-generated method stub
                                  new LoadMoreDataTask().execute();
                              }
                          });
                          return v;
                  
                      }
                      private class LoadMoreDataTask extends AsyncTask<Void, Void, Void> {
                  
                          @Override
                          protected Void doInBackground(Void... params) {
                  
                              if (isCancelled()) {
                                  return null;
                              }
                  
                              // Simulates a background task
                              try {
                                  Thread.sleep(1000);
                              } catch (InterruptedException e) {
                              }
                  
                              for (int i = 0; i < mAnimals.length; i++)
                                  mListItems.add(mAnimals[i]);
                  
                              return null;
                          }
                  
                          @Override
                          protected void onPostExecute(Void result) {
                              mListItems.add("Added after load more");
                  
                              // We need notify the adapter that the data have been changed
                              files.notifyDataSetChanged();
                  
                              // Call onLoadMoreComplete when the LoadMore task, has finished
                              lyt.onLoadMoreComplete();
                  
                              super.onPostExecute(result);
                          }
                  
                          @Override
                          protected void onCancelled() {
                              // Notify the loading more operation has finished
                              lyt.onLoadMoreComplete();
                          }
                      }
                  
                      private class PullToRefreshDataTask extends AsyncTask<Void, Void, Void> {
                  
                          @Override
                          protected Void doInBackground(Void... params) {
                  
                              if (isCancelled()) {
                                  return null;
                              }
                  
                              // Simulates a background task
                              try {
                                  Thread.sleep(1000);
                              } catch (InterruptedException e) {
                              }
                  
                              for (int i = 0; i < mAnimals.length; i++)
                                  mListItems.addFirst(mAnimals[i]);
                  
                              return null;
                          }
                  
                          @Override
                          protected void onPostExecute(Void result) {
                              mListItems.addFirst("Added after pull to refresh");
                  
                              // We need notify the adapter that the data have been changed
                              files.notifyDataSetChanged();
                  
                              // Call onLoadMoreComplete when the LoadMore task, has finished
                              lyt.onRefreshComplete();
                  
                              super.onPostExecute(result);
                          }
                  
                          @Override
                          protected void onCancelled() {
                              // Notify the loading more operation has finished
                              lyt.onLoadMoreComplete();
                          }
                      }
                  
                  }
                  

                  这里是pull-to-refresh and load-more的源代码图书馆.

                  这篇关于拉动刷新和加载更多列表视图,如 facebook的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  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事件)
                  <legend id='wpRGm'><style id='wpRGm'><dir id='wpRGm'><q id='wpRGm'></q></dir></style></legend>
                    <i id='wpRGm'><tr id='wpRGm'><dt id='wpRGm'><q id='wpRGm'><span id='wpRGm'><b id='wpRGm'><form id='wpRGm'><ins id='wpRGm'></ins><ul id='wpRGm'></ul><sub id='wpRGm'></sub></form><legend id='wpRGm'></legend><bdo id='wpRGm'><pre id='wpRGm'><center id='wpRGm'></center></pre></bdo></b><th id='wpRGm'></th></span></q></dt></tr></i><div id='wpRGm'><tfoot id='wpRGm'></tfoot><dl id='wpRGm'><fieldset id='wpRGm'></fieldset></dl></div>
                          <tbody id='wpRGm'></tbody>

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

                          <tfoot id='wpRGm'></tfoot>
                            <bdo id='wpRGm'></bdo><ul id='wpRGm'></ul>