android - How can i hide view in Listview according to the position -
i have relative layout , want hide , show on button click (for each item of list view).
adapter.java
@override public view getview(final int position, view convertview, viewgroup parent) { inflate list_items.xml set data on button click if view hidden view.setvisibility(view.visible); } else { view.setvisibility(view.gone); } } }); return cview; }
i have modified of code. try this, may works you.
@override public view getview(final int position, view convertview, viewgroup parent) { inflate list_items.xml set data //layout want hide , show barrl = (relativelayout) convertview.findviewbyid(r.id.layout20); button= (button) convertview.findviewbyid(r.id.button); // click button if (button not visible) { barrl.setvisibility(view.visible); } else { barrl.setvisibility(view.gone); } //button hide , show layout imageview arrowupdown = (imageview)convertview.findviewbyid(r.id.arrowupdown); arrowupdown.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if (arrowupdownis not visible) { arrowupdownis.setvisibility(view.visible); } else { arrowupdownis.setvisibility(view.gone); } notifydatasetchanged(); } }); return convertview; }
and don't set visibility of button in xml.
Comments
Post a Comment