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)
!