Reputation: 694
I would like to be able to change the content of a sliding drawer when the user clicks on a radio button . For example if user checks radio button "A" and then opens the sliding drawer , it contains 2 edit boxes and a spinner. After the sliding is closed if the user clicks radio button "B" and opens the slider again , now it contains a radio group and an edit text.
The sliding drawer is closed when the user presses the radio buttons.
Could someone suggest an idea in towards achieving this?
Upvotes: 2
Views: 1476
Reputation: 5270
You will need your context the view your drawer resides in. Then do something like this
If clicked 'A':
ViewGroup newContent = (ViewGroup) view.findViewById(R.id.myDrawerContent);
currentContext.getLayoutInflater().inflate(R.layout.theNewLayoutForA, newContent);
If clicked 'B':
ViewGroup newContent = (ViewGroup) view.findViewById(R.id.myDrawerContent);
currentContext.getLayoutInflater().inflate(R.layout.theNewLayoutForB, newContent);
Essentially all you are doing is getting your Sliding Drawer content view and inflating the new content into it.
Upvotes: 3