好吧,我是这个词的新人,我试图延迟充气,因为当你按下一个按钮时,其他按钮中的动画就会发生并且充气也会发生。
但是你看不到动画,因为 inflate 来得很快,所以我想将 inflate 延迟 2000 毫秒,这样你就可以先看到动画,然后再看到 inflate 中的信息。
我使用相同的按钮来调用动画和充气。
这是我的代码:
case R.id.btnsalud:
//This is the code for animations
//This is the loader for all the animations that is used for the button
{final Animation animBounceForSalud = AnimationUtils.loadAnimation(this, R.anim.bounce);
final Animation animBounceForSalud1 = AnimationUtils.loadAnimation(this, R.anim.bounce1);
//This object is the objects (buttons) whom is applied the animation
final Button animSalud = (Button)findViewById(R.id.btnobra);
final Button animSalud1 = (Button)findViewById(R.id.btnprotesta);
//This object (button) is the one which applies the animation to the other buttons
Button btnBounceSalud = (Button)findViewById(R.id.btnsalud);
animSalud.startAnimation(animBounceForSalud);
animSalud1.startAnimation(animBounceForSalud1);
animSalud.setVisibility(500);
animSalud1.setVisibility(500);}
//This is the code for inflate
//Check if the Layout already exists
LinearLayout hiddenLayout1 = (LinearLayout)findViewById(R.id.hiddenLayout);
if((hiddenLayout1 == null)){
//Right here is where you can defined in which layout is going to
//inflate the hidden layout
LinearLayout myLayout = (LinearLayout)findViewById(R.id.inflateposition0);
View hiddenInfo = getLayoutInflater().inflate(R.layout.salud, myLayout, false);
myLayout.addView(hiddenInfo);
}
break;
任何答案将不胜感激:D