如何显示布局从低速向左移动

Shu*_*ham 5 android android-animation android-layout

如何为从中移动的布局设置动画

左到右

点击按钮.最初它应该是不可见的,但在按钮点击它应该从左方向出来覆盖屏幕

Jim*_*aca 9

您将需要布置视图的xml,以便在其最后阶段显示它.然后将可见性设置为已消失.然后,您将创建一个TranslateAnimation

TranslateAnimation anim = new TranslateAnimation(-100f, 0f, 0f, 0f);  // might need to review the docs
anim.setDuration(1000); // set how long you want the animation

ViewYouWantToAnimate.setAnimation(anim);
ViewYouWantToAnimate.setVisibility(View.VISIBLE);
Run Code Online (Sandbox Code Playgroud)