watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvdtaxmzixmdyyma==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
Activity_main.xml
<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android" android:layout_width= "Fill_parent" android:layout_height= "fill_parent" android:orientation= "vertical" > <linearlayout android:layout_width = "Match_parent" android:layout_height= "Wrap_content" > <!--background is radar image---<framelayout Android:layout_width= "80DP" android:layout_height= "match_parent" android:background= "@drawab Le/ic_scanner_malware "> <imageview android:id=" @+id/iv_main_scan "android:l Ayout_width= "Fill_parent" android:layout_height= "fill_parent" android:src= "@drawable/act_sca Nning_03 "/> </FrameLayout> <linearlayout android:layout_width=" 0DP "Andro id:layout_weight= "1" android:layout_height= "match_parent" android:orientation= "vertical" Android:gravity= "Center_vertical "> <textview android:id=" @+id/tv_main_scan "android:layout_width=" Wrap_ Content "android:layout_height=" wrap_content "android:text=" Antivirus engine standby ... "/> < ProgressBar android:id= "@+id/pb_main_scan" style= "? Android:attr/progressbarstylehorizontal" Android:layout_width= "Match_parent" android:layout_height= "Wrap_content" android:progressdrawable= "<span style=" color: #ff0000; " > @drawable/my_progress</span> "/> <!--progressdrawable: Specify progress background and progress picture and </linearla Yout> </LinearLayout></LinearLayout>
My_progress.xml
<?xml version= "1.0" encoding= "Utf-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android > <!--Specify the background picture of the progress bar-- <item android:id= "@android: Id/background" android:drawable= "@drawable/security_progress_bg" ></item> <!--The progress picture of the specified progress bar-- <item android:id= "@android : id/progress " android:drawable=" @drawable/security_progress "></item></layer-list>
Mainactivity.java
Package Com.atguigu.l10_app;import Android.app.activity;import Android.os.asynctask;import android.os.Bundle; Import Android.view.animation.animation;import Android.view.animation.rotateanimation;import Android.widget.imageview;import Android.widget.progressbar;import Android.widget.textview;import Android.widget.toast;public class Mainactivity extends Activity {private ImageView iv_main_scan;private TextView tv_ Main_scan;private ProgressBar pb_main_scan; @Overrideprotected void OnCreate (Bundle savedinstancestate) { Super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main);//Rotated picture Iv_main_scan = (ImageView) Findviewbyid (R.id.iv_main_scan);//font hint Tv_main_scan = (TextView) Findviewbyid (R.id.tv_main_scan);//progress bar Pb_main_scan = (ProgressBar) Findviewbyid (R.id.pb_main_scan);//Start Scan animation startscananimation ();//Begin Scanning Application Startscan ();} /** * Start sub-thread scan app */private void Startscan () {new asynctask<void, void, void> () {//Update progress bar first friendly hint @overrideprotected v OID OnPreExecute () {TV_MAIN_SCAN.SEttext ("Start scanning antivirus!");} @Overrideprotected void Doinbackground (void ... params) {int appcount = 100;for (int i = 0; i < Appcount; i++) {try {Thr Ead.sleep (100);} catch (Interruptedexception e) {e.printstacktrace ();} Notification Update progress bar publishprogress ();} return null;} Synchronization progress display protected void Onprogressupdate (void[] values) {Pb_main_scan.incrementprogressby (1);} Clear the animation effect protected void onpostexecute (void result) {Tv_main_scan.settext ("No virus, please feel free to use!"); Toast.maketext (mainactivity.this, "scan complete, no virus found!", 0). Show ();//Stop Scanning animation iv_main_scan.clearanimation ();}}. Execute ();} /** * Start scan animation */private void Startscananimation () {rotateanimation animation = new Rotateanimation (0f, 360f,animation.rela Tive_to_self, 0.5f, animation.relative_to_self,0.5f); animation.setduration (+); Animation.setrepeatcount ( Animation.infinite);//Iv_main_scan.startanimation (Animation) that does not limit the number of repetitions//rotation of the picture to start the animation effect;}
360 Mobile Defender---scan kill radar effect