[Android Notes] imitation happy Security homepage dynamic effect, anzhuo happy Security

Source: Internet
Author: User

[Android Notes] imitation happy Security homepage dynamic effect, anzhuo happy Security

First look at the effect:


Layout:

<LinearLayout 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"    android:gravity="center"    tools:context=".MainActivity" >    <FrameLayout        android:layout_width="match_parent"        android:layout_height="match_parent" >        <ImageView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_gravity="center"            android:src="@drawable/homepage_disk_button_orange_normal" />        <ImageView            android:id="@+id/iv_rotate"            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_gravity="center"            android:src="@drawable/homepage_disk_orange_normal" />        <com.example.view.RadiationView            android:id="@+id/rv"            android:layout_width="250dp"            android:layout_height="250dp"            android:layout_gravity="center" />        <TextView            android:layout_width="wrap_content"            android:layout_height="wrap_content"            android:layout_gravity="center"            android:text="SB"            android:textColor="#ffffff"            android:textSize="30sp" />    </FrameLayout></LinearLayout>

Rotation Animation:

<?xml version="1.0" encoding="utf-8"?><rotate xmlns:android="http://schemas.android.com/apk/res/android"    android:duration="12000"    android:fromDegrees="0"    android:pivotX="50%"    android:pivotY="50%"    android:startOffset="0"    android:interpolator="@android:anim/linear_interpolator"    android:repeatCount="infinite"    android:repeatMode="restart"    android:toDegrees="360" />

View with radiation effect:

Package com. example. view; import android. content. context; import android. graphics. canvas; import android. graphics. color; import android. graphics. paint; import android. OS. handler; import android. util. attributeSet; import android. util. log; import android. view. view;/*** @ author Rowandjj ** view with radiation effect */public class RadiationView extends View {/*** Paint brush */private Paint mPaint = new Paint (); /*** color */private int MColor = 0x3f990e;/*** transparency */private int mAlpha = 60; private Handler mHandler = null; private static final int MESSAGE_DRAW = 0; private static final String TAG = "RadiationView"; private int width; private int height;/*** Diffusion speed */private int speed = 30; /*** maximum radiation radius */private int maxRadius = 100; private int centerX; private int centerY;/*** minimum radius */private int minRadius = 70; /*** current RADIUS */private int ra Dius = minRadius; private boolean isStarted = false; public RadiationView (Context context) {super (context); init () ;}public RadiationView (Context context Context, AttributeSet attrs) {super (context, attrs, 0); init ();} public void startRadiate () {isStarted = true; mHandler. sendEmptyMessage (MESSAGE_DRAW);} private void init () {mPaint = new Paint (); mPaint. setStrokeWidth (1); // you must set color before setting alphamPaint. setColor (mColor); m Paint. setAlpha (mAlpha); mHandler = new Handler () {public void handleMessage (android. OS. message msg) {if (msg. what = MESSAGE_DRAW) {invalidate (); if (isStarted) {sendEmptyMessageDelayed (MESSAGE_DRAW, speed) ;}};}@ Overrideprotected void onLayout (boolean changed, int left, int top, int right, int bottom) {super. onLayout (changed, left, top, right, bottom); width = this. getWidth (); height = this. getHeight (); if (w Idth <= 0 | height <= 0) {throw new RuntimeException ("size illegal");} // center centerX = width/2; centerY = height/2; // maxRadius = (width> height )? Height/2: width/2; Log. I (TAG, "MAX" + maxRadius); if (maxRadius <70) {throw new RuntimeException ("size too small") ;}}@ Overrideprotected void onDraw (Canvas canvas Canvas) {mPaint. setColor (mColor); mPaint. setAlpha (mAlpha); if (radius <= 0) {return;} if (radius> maxRadius) {radius = minRadius;} canvas. save (); canvas. drawCircle (centerX, centerY, radius, mPaint); canvas. restore (); radius + = 1 ;}@ Overrideprotected void onAttachedToWindow () {super. onAttachedToWindow (); this. setLayerType (View. LAYER_TYPE_SOFTWARE, null);} public void setColor (int color) {this. mColor = color;} public void setSpeed (int speed) {this. speed = speed;} public void setMinRadius (int radius) {this. minRadius = radius ;}}

Call code:

Package com. example. animdemo1; import android. app. activity; import android. OS. bundle; import android. view. animation. animation; import android. view. animation. animationUtils; import android. widget. imageView; import com. example. view. radiationView; public class MainActivity extends Activity {private ImageView iv = null; private RadiationView rv = null; @ Overrideprotected void onCreate (Bundle savedInstanceState) {super. onCreate (savedInstanceState); setContentView (R. layout. activity_main); iv = (ImageView) findViewById (R. id. iv_rotate); rv = (RadiationView) findViewById (R. id. rv); rv. setMinRadius (70); // radiation radius rv. startRadiate (); // start to radiate Animation anim = AnimationUtils. loadAnimation (this, R. anim. rotate_circle_anim); iv. startAnimation (anim); // start animation }}







Is the Android Market Software Secure and easy to use?

Le 'an was launched by Lenovo. I am Lenovo's mobile phone. I have been using Happy security anti-virus software when I bought it, and the results are good.

What is the security effect of Android anti-virus software? Please.

Lean is a free and active mobile phone security software that provides function services such as fee-absorbing stars, traffic monitoring, privacy protection, harassment interception, virus detection and removal, mobile phone theft, security backup, and mobile accelerator. Core security technology Advantages: Protection against privacy leaks, protection of user privacy, prevention of other applications, protection against software fees, monitoring, and prevention of unnecessary traffic loss caused by malware; protects against unfamiliar harassment, prevents harassing calls and text messages, and receives and sends messages as needed. one-click slimming improves performance, and one-click stopping background software; virus detection and removal, security protection, and active bottom-layer Interception, scan and kill all viruses and intrusions.

Related Article

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.