Show only a part of SlidingDrawer?
I want to have the SlidingDrawer show in 2 parts. On the first swipe up it shows only 1 button. and in the other swipe up, it shows the second button.
How c开发者_运维百科an I do this? Thanks.You could always have a counter in the SlidingDrawer that counts how many times the user have opened the drawer. And depending on the counter you either choose another layout or just use setVisibility on different views.
Simple example, lets say you have button1 the first time the user opens the drawer and button2 the second time. If the user draws it a third time set the counter to 0 again.
if(counter==0) {
button1.setVisibility(View.VISIBLE);
button2.setVisibility(View.GONE);
}
else {
button1.setVisibility(View.GONE);
button2.setVisibility(View.VISIBLE);
}
SlidingDrawer For the counter you could use setOnDrawerCloseListener to change the value since you want to have the upcoming counter value before the user have opened the drawer.
精彩评论