Android share a simple and fun animation effect

Source: Internet
Author: User

This issue begins with a few simple and interesting animations that you will share.

:



The effect is good, and the implementation is not much difficulty, on the code

public int id[] = {r.drawable.fengjing_1, r.drawable.fengjing_2,r.drawable.fengjing_3, R.drawable.fengjing_4, R.drawable.fengjing_5, r.drawable.fengjing_6};p ublic String list[] = {"One", "two", "three", "four", "five", "Six"};p rivate ListView ML Istview;private ImageView mimageview;protected void OnCreate (Bundle savedinstancestate) {super.oncreate ( Savedinstancestate); Setcontentview (R.layout.activity_main); Initview ();} private void Initview () {Mlistview = (ListView) Findviewbyid (r.id.list); arrayadapter<string> adapter = new Arrayadapter<string> (Mainactivity.this, Android. R.layout.simple_list_item_1, list); Mlistview.setadapter (adapter); Mlistview.setonitemclicklistener (this); Mimageview = (ImageView) Findviewbyid (r.id.img); Mimageview.setonclicklistener (this);} @SuppressLint ("Newapi") private void animation (final int position) {Final View vis;final view invis;if ( Mlistview.getvisibility () = = view.visible) {vis = Mlistview;invis = Mimageview;} else {vis = Mimageview;invis = MListView; }objectanimaTor objectanimator = objectanimator.offloat (Vis, "RotationY", 0f, 90f); objectanimator.setduration; o Bjectanimator.start (); final Objectanimator ObjectAnimator2 = objectanimator.offloat (Invis, "RotationY", -90f, 0f); o Bjectanimator2.setduration (+); Objectanimator.addlistener (new Animatorlisteneradapter () {@Overridepublic void Onanimationend (Animator animation) {super.onanimationend (animation); Objectanimator2.start (); Vis.setvisibility ( View.gone); Mimageview.setimageresource (Id[position]); invis.setvisibility (view.visible);}}); @Overridepublic void Onitemclick (adapterview<?> arg0, View arg1, int arg2, long arg3) {animation (arg2);} @Overridepublic void OnClick (View arg0) {animation (0);}

The main use of property animation, about the property animation and so I have more experience when the details of the time to tell. This issue is purely a sharing effect, very water ah ...


Project Source



Android share a simple and fun animation effect

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.