有人可以让我知道如何为图像按钮设置动画,使高度增加吗? 我读过的任何示例都会缩放按钮的高度。 我只是想点击底部的顶部增加高度。我不希望按钮位置移动,只需点击按钮,高度就会增加。 继承人我的代码Android动画增加ImageButton的高度
<ImageButton
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/buttton"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="66dp"
android:src="@drawable/iman"
android:maxHeight="50dp"
android:minHeight="50dp" />
findViewById(R.id.buttton).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Animator scale = ObjectAnimator.ofPropertyValuesHolder(v,
PropertyValuesHolder.ofFloat(View.SCALE_Y, 1, 1.5f, 1)
);
scale.setDuration(1000);
scale.start();
}
});
感谢 克里斯
您可以发布您的布局文件,其中包含此按钮 –