Issue
Think I have 4 button on navbar. First button contains some data or items and other buttons also contains some data or items.
Note: All four buttons under a same xml file.
I want if I click first button it will show me first button data or items and same time it will hide others three buttons data or items. And I want to use same method for all buttons.
Solution
You can use setVisibility
Like this (in Java):
myBtn= (Button) findViewById(R.id.btn);
myBtn2= (Button) findViewById(R.id.btn2);
myBtn3= (Button) findViewById(R.id.btn3);
myBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// Do something here that shows data.
myBtn2.setVisibility(View.GONE);
myBtn2.setVisibility(View.GONE);
}
});
Answered By - Anuraag Potdaar
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.