I try to open/close my slidingdrawer with animateOpen() and animateClose(), but it seems it opens and closes instantaneously, like open() and close(). What's wrong?
I've seen that SlidingDrawer can't be customized (can't be animated with custom animation for instance, even not with custom open/close duration). Do I have to copy SlidingDrawer's code just to change the animation duration?
Thanks
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.home);
// Open and close banner
final SlidingDrawer banner = (SlidingDrawer) findViewById(R.id.banner);
banner.animateOpen();
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
banner.animateClose();
}
}, 2000);
//...
}
EDIT
Doing
final SlidingDrawer banner = (SlidingDrawer) findViewById(R.id.banner);
final Animation hideBanner = AnimationUtils.loadAnimation(this, R.anim.hide_banner);
banner.setAnimation(showBanner);
animates the handler only, even though I don't do banner.animateOpen() or banner.startAnimation(showbanner)!
This youtube video shows a sliding drawer with a custom animation. You should be able to use or modify this code to solve your issue...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With