Posts Android Indicator
Post
Cancel

Android Indicator

// @ res/anim/my_indicator.xml

1
2
<rotate xmlns:android="http://schemas.android.com/apk/res/android" android:duration="2000" android:fillafter="false" android:fromdegrees="0" android:interpolator="@android:anim/linear_interpolator" android:pivotx="50%" android:pivoty="50%" android:repeatcount="infinite" android:startoffset="0" android:todegrees="-360"></rotate>

// @ activity

1
    <imageview android:id="@+id/indicatorLbC" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerinparent="true" android:src="@drawable/indicator"></imageview>

// @ activity java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
	// indicator public var
	ImageView Indicator;

//	protected void onCreate(Bundle savedInstanceState) {
		//indicator
		Indicator = (ImageView) findViewById(R.id.indicatorLbC);
		startIndicator();

	public void startIndicator() {
		RotateAnimation rotation = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
		rotation.setDuration(1200);
		rotation.setInterpolator(new LinearInterpolator());
		rotation.setRepeatMode(Animation.RESTART);
		rotation.setRepeatCount(Animation.INFINITE);

		Indicator.startAnimation(rotation);
	}

	public void stopIndicator() {
		Indicator.setVisibility(View.INVISIBLE);
		Indicator.setAnimation(null);
	}
.
.
.
when process ends call
stopIndicator();

//save this png @ drawable

origin - http://www.pipiscrew.com/?p=523 android-indicator

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags