我定义为绘制形状:ImageView的不希望它被setAlpha()隐藏后出现
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#0075b5"/>
<size android:height="2dp"/>
</shape>
我用这种形状在ImageView的源:
<ImageView android:layout_height="2dp"
android:layout_width="fill_parent"
android:src="@drawable/shape_blue_line"
android:id="@+id/ptt_blueLineImageView"/>
的问题出现时,我想我的切换的ImageView:
private void toggleAnimatedLogo() {
if (viewFlipper.getDisplayedChild() == 2) {
animatedLogo.setAlpha(ALHPA_TRANSPARENT);
blueLine.setAlpha(ALHPA_TRANSPARENT);
} else {
animatedLogo.setAlpha(ALHPA_VISIBLE);
blueLine.setAlpha(ALHPA_VISIBLE);
}
}
其结果是,这种方法的第一次执行两个ImageViews消失,但只有动画的出现在第二个。消失后的线路根本不想显示。我想有一个工作切换方法。
我已经试过这一点 - 它不工作的。 (我认为他们正在使用下面的setAlpha()) –
此外,如果我在我的动画ImageView上使用setVisibility()它不会隐藏... –
你调用了[View.clearAnimation()](http:// developer .android.com /参考/机器人/视图/ View.html#clearAnimation())。 –