Open source project explosion effect implementation.

Source: Internet
Author: User

The Android Explosionfield project on GitHub home page is: Https://github.com/tyrantgit/ExplosionField
Android Explosionfield is simple to use and can be used to produce the desired effect for almost any view.
Explosionfield need to be dragged down to their GitHub home page before use, and imported as Lib.

Run:

The code is as follows:

1  PackageCom.lixu.baozha;2 3 Importandroid.app.Activity;4 ImportAndroid.os.Bundle;5 ImportAndroid.view.View;6 ImportAndroid.view.View.OnClickListener;7 ImportAndroid.widget.Button;8 ImportAndroid.widget.ImageView;9 ImportAndroid.widget.Toast;Ten ImportTyrantgit.explosionfield.ExplosionField; One  A  Public classMainactivityextendsActivityImplementsOnclicklistener { -     PrivateImageView IV; -     PrivateImageView Iv1; the     PrivateImageView iv2; -     PrivateImageView Iv3; -     PrivateExplosionfield Mexplosionfield; -  + @Override -     protected voidonCreate (Bundle savedinstancestate) { +         Super. OnCreate (savedinstancestate); A Setcontentview (r.layout.activity_main); at  -Mexplosionfield = Explosionfield.attach2window ( This); -  -IV =(ImageView) Findviewbyid (r.id.aixin); -IV1 =(ImageView) Findviewbyid (r.id.aixin1); -Iv2 =(ImageView) Findviewbyid (r.id.aixin2); inIv3 =(ImageView) Findviewbyid (r.id.aixin3); -  toIv.setonclicklistener ( This); +Iv1.setonclicklistener ( This); -Iv2.setonclicklistener ( This); theIv3.setonclicklistener ( This); *  $Button BTN =(Button) Findviewbyid (R.ID.BTN);Panax NotoginsengBtn.setonclicklistener ( This); -  the     } +  A @Override the      Public voidOnClick (View v) { +         Switch(V.getid ()) { -          Caser.id.aixin: $ Mexplosionfield.explode (v); $  -Toast.maketext (Getapplicationcontext (), "Heartbreak!! ", 0). Show (); -  the              Break; -          Caser.id.aixin1:Wuyi Mexplosionfield.explode (v); the  -Toast.maketext (Getapplicationcontext (), "Heartbreak!! ", 0). Show (); Wu  -              Break; About          Caser.id.aixin2: $ Mexplosionfield.explode (v); -  -Toast.maketext (Getapplicationcontext (), "Heartbreak!! ", 0). Show (); -  A              Break; +          Caser.id.aixin3: the Mexplosionfield.explode (v); -  $Toast.maketext (Getapplicationcontext (), "Heartbreak!! ", 0). Show (); the  the              Break; the  the          Caser.id.btn: -  in Mexplosionfield.explode (iv); the Mexplosionfield.explode (IV1); the Mexplosionfield.explode (IV2); About Mexplosionfield.explode (IV3); the  theToast.maketext (Getapplicationcontext (), "Tiannvsanhua! ", 0). Show (); the  +              Break; -  the         default:Bayi              Break; the         } the  -     } -}

XML file:

1 <Relativelayoutxmlns:android= "Http://schemas.android.com/apk/res/android"2 Xmlns:tools= "Http://schemas.android.com/tools"3 Android:id= "@+id/linearlayout1"4 Android:layout_width= "Match_parent"5 Android:layout_height= "Match_parent"6 Tools:context= "Com.lixu.baozha.MainActivity" >7 8 9     <LinearLayoutTen         Android:id= "@+id/linearlayout2" One Android:layout_width= "Match_parent" A Android:layout_height= "200DP" - Android:layout_alignparentleft= "true" - Android:layout_alignparenttop= "true" > the  -         <ImageView -             Android:id= "@+id/aixin" - Android:layout_width= "Wrap_content" + Android:layout_height= "80DP" - Android:layout_weight= "1" + Android:background= "@drawable/aixin" /> A  at         <ImageView -             Android:id= "@+id/aixin1" - Android:layout_width= "Wrap_content" - Android:layout_height= "80DP" - Android:layout_weight= "1" - Android:background= "@drawable/aixin" /> in  -         <ImageView to             Android:id= "@+id/aixin2" + Android:layout_width= "Wrap_content" - Android:layout_height= "80DP" the Android:layout_weight= "1" * Android:background= "@drawable/aixin" /> $ Panax Notoginseng         <ImageView -             Android:id= "@+id/aixin3" the Android:layout_width= "Wrap_content" + Android:layout_height= "80DP" A Android:layout_weight= "1" the Android:background= "@drawable/aixin" /> +     </LinearLayout> -  $     <Button $         Android:id= "@+id/btn" - Android:layout_width= "Wrap_content" - Android:layout_height= "Wrap_content" the Android:layout_below= "@+id/linearlayout2" - Android:layout_centerhorizontal= "true"Wuyi Android:layout_margintop= "76DP" the Android:text= "Start" /> -  Wu </Relativelayout>

Open source project explosion effect implementation.

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.