Android progress bar

Source: Internet
Author: User

1 <?XML version= "1.0" encoding= "Utf-8"?>2 <LinearLayoutxmlns:android= "Http://schemas.android.com/apk/res/android"3 Xmlns:tools= "Http://schemas.android.com/tools"4 Android:layout_width= "Match_parent"5 Android:layout_height= "Match_parent"6 Tools:context= "Com.example.administrator.android.TestActivity4"7 android:orientation= "vertical">8     <!--progress bar -9     <ProgressBarTen         Android:layout_width= "Match_parent" One Android:layout_height= "Wrap_content" A style= "? Android:attr/progressbarstylehorizontal" - android:progress= "+" - android:secondaryprogress= " the" the Android:max= "+" - Android:id= "@+id/pb_1"/> -     <!--Rotation progress bar - -     <ProgressBar +         Android:layout_width= "Match_parent" - Android:layout_height= "Wrap_content" + style= "? Android:attr/progressbarstylelarge" A Android:id= "@+id/pb_2" at android:visibility= "Gone"/> -     <!--to drag a progress bar - -     <SeekBar -         Android:layout_width= "Match_parent" - Android:layout_height= "Wrap_content" - android:progress= "0" in android:secondaryprogress= "0" - Android:max= "a" to Android:id= "@+id/se_1"/> +     <!--Star progress bar - -     <Ratingbar the         Android:layout_width= "Match_parent" * Android:layout_height= "Wrap_content" $ Android:numstars= "Ten"Panax Notoginseng android:rating= "5.5" - Android:isindicator= "true"/> the </LinearLayout>
1  Packagecom.example.administrator.android;2 3 ImportAndroid.app.AlertDialog;4 Importandroid.support.v7.app.AppCompatActivity;5 ImportAndroid.os.Bundle;6 ImportAndroid.util.Log;7 ImportAndroid.view.View;8 ImportAndroid.widget.ProgressBar;9 ImportAndroid.widget.SeekBar;Ten ImportAndroid.widget.Toast; One  A  Public classTestActivity4extendsappcompatactivity { - SeekBar se_1; - ProgressBar pb_1; the ProgressBar pb_2; - @Override -     protected voidonCreate (Bundle savedinstancestate) { -         Super. OnCreate (savedinstancestate); + Setcontentview (R.LAYOUT.ACTIVITY_TEST4); -  +Se_1 =(SeekBar) Findviewbyid (r.id.se_1); APb_1 =(ProgressBar) Findviewbyid (r.id.pb_1); atpb_2 =(ProgressBar) Findviewbyid (r.id.pb_2); -  -Se_1.setonseekbarchangelistener (NewSeekbar.onseekbarchangelistener () { - //Progress Change Trigger - @Override -              Public voidOnprogresschanged (SeekBar SeekBar,intProgressBooleanFromuser) { in                 //Progress Bar 1 Progress Value - pb_1.setprogress (progress); to                 //determine if the maximum value is reached +                 if(progress==Se_1.getmax ()) -                 { thePb_2.setvisibility (view.invisible);//not displayed but the location is still retained *                 } $                 ElsePanax Notoginseng                 { - pb_2.setvisibility (view.visible); the                 } + //as long as the progress change is triggered . A //Toast.maketext (Testactivity4.this, "current progress =" +progress, Toast.length_short). Show (); the             } + //Start dragging - @Override $              Public voidOnstarttrackingtouch (SeekBar SeekBar) { $  -LOG.E ("TAG", "progress bar start dragging"); -             } the //End Drag - @OverrideWuyi              Public voidOnstoptrackingtouch (SeekBar SeekBar) { theLOG.E ("TAG", "Progress bar Stop dragging"); -             } Wu         }); -     } About}
1<?xml version= "1.0" encoding= "Utf-8"?>2<manifest xmlns:android= "Http://schemas.android.com/apk/res/android"3      Package= "Com.example.administrator.android" >4 5<Application6Android:allowbackup= "true"7android:icon= "@mipmap/ic_launcher"8Android:label= "@string/app_name"9Android:supportsrtl= "true"TenAndroid:theme= "@style/apptheme" > One<activity android:name= ". Mainactivity "> A</activity> -<activity android:name= ". TestActivity4 "> -<intent-filter> the<action android:name= "Android.intent.action.MAIN"/> -<category android:name= "Android.intent.category.LAUNCHER"/> -</intent-filter> -</activity> +</application> -  +</manifest>

Android progress bar

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.