我有一个布局,其中包含一个列表视图和一个图像按钮:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:paddingTop="4px"
android:background="@color/bgColor">
<ImageButton
android:id="@+id/imageButton"
android:src="@drawable/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="0dp"
android:layout_alignParentBottom="true"/>
<ListView
android:layout_above="@+id/imageButton"
android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:drawSelectorOnTop="false"
android:background = "@drawable/list_bg"
android:divider="@drawable/grade"
android:dividerHeight ="1px"
android:cacheColorHint="#00000000"
android:fastScrollEnabled= "true"
android:scrollingCache ="true"
android:smoothScrollbar="false"
>
</ListView>
</RelativeLayout>
根据用户的选择,我使用这个来隐藏或显示图像按钮:
ImageButton myButton = (ImageButton) findViewById(R.id.imageButton);
myButton.setVisibility(View.GONE);
代码运行正常,但我想添加动画来实现隐藏/显示的效果。如何实现这个效果?