#点击按钮的动画
android:background="?attr/selectableItemBackgroundBorderless"
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false">
<shape>
<solid android:color="@color/colorPageBg" />
</shape>
</item>
<item android:state_pressed="true">
<shape>
<solid android:color="@color/itemLowBackground" />
</shape>
</item>
<item android:state_pressed="false">
<shape>
<solid android:color="@color/colorPageBg" />
</shape>
</item>
</selector>
<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/me_icon_normal" android:state_pressed="false"/>
<item android:drawable="@drawable/me_icon_pressed" android:state_pressed="true"/>
</selector>
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android" >
<alpha
android:fromAlpha="0.1"
android:toAlpha="1.0"
android:duration="100"
/>
</set>
public void onClick(View view) {
Animation animation = AnimationUtils.loadAnimation(mContext, R.anim.alpha);
switch (view.getId()){
case R.id.tv_alpha:
tv_alpha.startAnimation(animation);
Toast.makeText(mContext,"注意我的透明变化效果",Toast.LENGTH_SHORT).show();
break;
}
}