How is possible to hide/show Layout element in all rows of listView after clicked on button.
my code
Button edit = (Button) findViewById(R.id.edit);
edit.setOnClickListener(new Button.OnClickListener() {
public void onClick(View v) {
LinearLayout ll = (LinearLayout)findViewById(R.id.hidden);
if (ll.getVisibility() == View.GONE)
ll.setVisibility(View.VISIBLE);
else
ll.setVisibility(View.GONE);
}
});
But it hide only element in first row.
You must use a flag, raised or lowered by the click method. Then use this flag in the getView method of your adapter to hide or show views. At the end of the click method, call notifyDataSetChanged to refresh your views.