于是我开始了我的活动,然后需要明确的ImageButton开始动画
setContentView(R.layout.myxmllayoutfile);
一切都很好过,但我想从一无所有(即1%),使我的ImageButton突然增长(规模)。然而,布局已经显示按钮,所以它突然消失,然后增长回来,而不是从无增长。
我有一些替代品,但有没有一个真正的解决方案?: 1.从屏幕外飞行动画的imagebutton? ;或 2.使它在xml中很小,然后增长它,然后如果需要更改可点击区域?或 3.有没有更好的解决方案?
UPDATE: 作为建议我尝试:
<ImageButton
android:id="@+id/spinner"
android:scaleType="fitXY"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:background="@drawable/clear"
android:orientation="horizontal"
android:visibility="invisible"
android:src="@drawable/spin"
/>
,在我的java:
scaleView.startAnimation(scanimation);
ImageButton spinnerbutton=(ImageButton)findViewById(R.id.spinner);
spinnerbutton.setVisibility(View.VISIBLE);
,但它仍然是可见它缩小到1%,那么增长之前!建议欢迎。
UPDATE2:
什么都没有用编辑下面的代码更改:
public void growit() {
final ImageView scaleView = (ImageView) findViewById(R.id.spinner);
Animation scanimation = AnimationUtils.loadAnimation(this, R.anim.throbbing2);
scanimation.setFillAfter(true);
scanimation.setAnimationListener(new Animation.AnimationListener() {
public void onAnimationStart(Animation a) { Log.e("growit", "---- animation start listener called");
scaleView.setVisibility(View.VISIBLE);
}
public void onAnimationRepeat(Animation a) {
}
public void onAnimationEnd(Animation a) {
}
});
scaleView.startAnimation(scanimation);
}
在xml代码中隐藏图像按钮。 加入android:visibility =“gone”或“invisible”如果它适合您的情况 – Maxim 2012-07-18 10:57:31
android:visibility =“invisible”已经。我会去尝试,因为我没有任何损失。 – 2012-07-19 05:46:08