Created
April 2, 2014 07:46
-
-
Save MilesChou/9929645 to your computer and use it in GitHub Desktop.
摩天輪動畫
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<RelativeLayout | |
xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
tools:context="net.polaris.fragment.QrCodeHistoryFragment"> | |
<RelativeLayout | |
android:id="@+id/parent" | |
android:layout_centerInParent="true" | |
android:layout_width="200dp" | |
android:layout_height="30dp" | |
android:background="#F00"> | |
<ImageView | |
android:id="@+id/child" | |
android:layout_width="20dp" | |
android:layout_height="20dp" | |
android:layout_margin="5dp" | |
android:layout_alignParentRight="true" | |
android:layout_centerVertical="true" | |
android:background="#0CC"/> | |
</RelativeLayout> | |
</RelativeLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<rotate xmlns:android="http://schemas.android.com/apk/res/android" | |
android:duration="2000" | |
android:fromDegrees="0" | |
android:interpolator="@android:anim/linear_interpolator" | |
android:pivotX="50%" | |
android:pivotY="50%" | |
android:repeatCount="infinite" | |
android:toDegrees="359" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<rotate xmlns:android="http://schemas.android.com/apk/res/android" | |
android:duration="2000" | |
android:fromDegrees="360" | |
android:interpolator="@android:anim/linear_interpolator" | |
android:pivotX="50%" | |
android:pivotY="50%" | |
android:repeatCount="infinite" | |
android:toDegrees="1" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ignore import | |
public class TestFragment extends Fragment | |
{ | |
@Override | |
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) | |
{ | |
return inflater.inflate(R.layout.fragment, container, false); | |
} | |
@Override | |
public void onViewCreated(View view, Bundle savedInstanceState) | |
{ | |
View parent = view.findViewById(R.id.parent); | |
View child = view.findViewById(R.id.child); | |
Animation clock = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_clock); | |
Animation reverse = AnimationUtils.loadAnimation(getActivity(), R.anim.rotate_reverse); | |
parent.startAnimation(clock); | |
child.startAnimation(reverse); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment