Reputation: 887
I'm new in Android.
I have a Button (named "A") and a ListView.
Each item in the ListView have a TextView and a Button (name "B").
What I want to do is when click on the button A, all button (B) in the listview become "invisible".
How can I do this?
Please help!
Upvotes: 1
Views: 1489
Reputation: 33
If you are using a custom Adapter (for example extends from BaseAdapter) you can access the view of each item in the list with the "getView" method. So in the OnClickListener of Button A, do :
`button.setVisibility(View.INVISIBLE);
on each button B of each item in the List.
Upvotes: 0
Reputation: 16641
This can be done by using .setVisibility(). Depending on what you want, you can do 1 of the following:
view.setVisibility(View.VISIBLE);
view.setVisibility(View.GONE);
view.setVisibility(View.INVISIBLE);
The difference between GONE and INVISIBLE is that in case of GONE, it fills up no space, and in the case of INVISIBLE, it will still fill up space, but this will simply be empty space.
Upvotes: 3