我有一个按钮,基本上改变的TextView每次被点击。是否可以将动画与此关联?我看过3D翻转之类的东西,但它们对我来说似乎有点太高级了。有什么更简单的建议吗?
final Button button1 = (Button) findViewById(R.id.button1);
final TextView textView = (TextView) findViewById(R.id.text_random_text);
button1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
textView.setText(getNextRandomCuisine());
}
});发布于 2013-05-07 16:54:36
我建议你看看Android webPage。AnimationUtils类可以帮助你从xml文件夹中加载和动画模式,例如,你可以制作一个“http://developer.android.com/reference/android/view/animation/AnimationUtils.html”动画,你应该创建一个xml datei,例如命名为"fadein.xml“它应该是这样的。
<?xml version="1.0" encoding="utf-8"?>
<alpha
android:duration="200"
android:fromAlpha="0.0"
android:toAlpha="1.0" >
</alpha>这样你就告诉你的android设备,这个动画应该改变你的视图的alpha值(也是透明度),从0到1,让你的视图可见,"duration“参数就是执行这个动画需要多少毫秒的时间。
https://stackoverflow.com/questions/12765758
复制相似问题