java - SwipeRefreshLayout only shows one item? -
I have tried to implement a SwipeRefreshLayout to an existing ListView, but when I run this program, It only refreshes me by dragging one item when I discover it. Fresh animation works, though. Here is the relevant code:
Find item = (list view )UbiID (R.D.Malic); Adapter = new adapter (CTX); Adapter.setTextKey ("myItem"); //adapter.setImageKey("image "); Items.setAdapter (adapter); Adapter.loadObjects (); Last SwipeRefreshLayout swipeView = (SwipeRefreshLayout) findViewById (R.id.swipe2); Swipeview.setEnabled (wrong); SwipeViewksetOnRefreshListener (New SwipeRefreshLayout.OnRefreshListener () {@Override public void onRefresh () {swipeView.setRefreshing (right) ;. (new handler ()) PostDelayed (new Runnable () {@Override public void run () {swipeView. SetRefreshing (wrong);}}, 3000);}}); Override Public Zero (AbsListView absListView, int i) {} Override public zeros on @Scroll {Items in AbsoluteView, int firstVisibleItem, int visibleItemCount, int totalItemCount} {Boolean enabled = False; (Item = null & amp ;! & amp; items.getChildCount () & gt; 0) {// to check that list before the item is visible Boolean firstItemVisible = items.getFirstVisiblePosition () == 0; // if the check first before you see Boolean topOfFirstItemVisible = items.getChildAt (0) .getTop () == 0; // Enable or disable the latest layout = firstItemVisible & amp; & Amp; TopOfFirstItemVisible;} swipeView.setEnabled (enabled);}});
There was not SwipeRefreshLayout problem. I put a ListView in the XML in ScrollView, causing the error.
Comments
Post a Comment