In xml:
Copy the codeThe code is as follows:
<ImageView
android:
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:src="@drawable/touch" />
In java:
Copy the codeThe code is as follows:
mTouchView = (ImageView) findViewById();
AlphaAnimation mAlphaAnimation = new AlphaAnimation(0.1f, 1.0f); //// Create an AlphaAnimation object with the parameters from transparent to opaque
(1000);// Set animation time
();//Define the animation repetition time
();//Define the behavior of animation by setting repetition time
(mAlphaAnimation);
();