In viewpager the gridview data after an item is deleted, gridview how to update it, I used notifyDataSetChanged (), no response. The getItemPosition return value to POSITION_NONE, is useless. Paste code PagerAdapter the second floor, who gave a look at what was wrong.<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply: class GuidePageAdapter extends PagerAdapter { @ Override public int getCount () { return pageView.size (); } @ Override public boolean isViewFromObject (View arg0, Object arg1) { return arg0 == arg1; } @ Override public int getItemPosition (Object object) { return POSITION_NONE; } @ Override public void destroyItem (View arg0, int arg1, Object arg2) { ((ViewPager) arg0) removeView (pageView.get (arg1));. } @ Override public Object instantiateItem (View arg0, int arg1) { ((ViewPager) arg0) addView (pageView.get (arg1));. return pageView.get (arg1); } @ Override public void restoreState (Parcelable arg0, ClassLoader arg1) { } @ Override public Parcelable saveState () { return null; } @ Override public void startUpdate (View arg0) { } @ Override public void finishUpdate (View arg0) { } } Reply: I have encountered this problem, I finally item.setVisible (View.GONE) to resolve
Reply: reference to the second floor of the reply: I have encountered this problem, I finally item.setVisible (View.GONE) to solve < / fieldset> Is one way, but if there is to join the data? Reply: LZ Can viewpage code containing all posted gridview Reply: Since I was fixing a viewpage have four item, only with View.GONE To really solve should be remove from the parent control in the fall, he will automatically disappear Reply: references, 5th Floor reply: Since I was fixing a viewpage has 4 item, only with View.GONE To really solve should be remove from the parent control in the fall, he will automatically disappear Should @ Override public void destroyItem (View arg0, int arg1, Object arg2) { ((ViewPager) arg0) removeView (pageView.get (arg1));. } Thus it is possible, but I do not know when he will call this method. He does not automatically invoked. Reply: You onClick time, it removeView Reply: reference to the 7th floor of replies: onClick when you're on removeView Seemingly, can not, in the end I had to determine if the user did not delete the application deleted it. I still forget to restart the activity. Do not know the system overhead so big? Reply: Restart activity too unscientific, who will help me ah ........ Reply: Why not follow it
No comments:
Post a Comment