Android Development Notes (11) Slide Bar Seekbar

Source: Internet
Author: User

The operation of the Android slider is particularly simple, with getprogress () to get the Seekbar position, and the Seekbar position can be set by setprogress (int progress). To dynamically get the user to Seekbar operation, only need to set Setonseekbarchangelistener.

Setonseekbarchangelistener (new Seekbar.onseekbarchangelistener ()

The sample code is as follows:

1 Importandroid.support.v7.app.AppCompatActivity;2 ImportAndroid.os.Bundle;3 ImportAndroid.widget.SeekBar;4 ImportAndroid.widget.TextView;5 6  Public classMainactivityextendsappcompatactivity {7 8     PrivateSeekBar SeekBar;9     PrivateTextView TextView;Ten  One @Override A     protected voidonCreate (Bundle savedinstancestate) { -         Super. OnCreate (savedinstancestate); - Setcontentview (r.layout.activity_main); the  -SeekBar =(SeekBar) Findviewbyid (R.id.seekbar); -TextView =(TextView) Findviewbyid (R.id.textview); -  +Seekbar.setonseekbarchangelistener (NewSeekbar.onseekbarchangelistener () { - @Override +              Public voidOnprogresschanged (SeekBar SeekBar,intIBooleanb) { ATextview.settext (i + "Progress")); at             } -  - @Override -              Public voidOnstarttrackingtouch (SeekBar SeekBar) { -  -             } in  - @Override to              Public voidOnstoptrackingtouch (SeekBar SeekBar) { +  -             } the         }); *     } $}

Android Development Notes (11) Slide Bar Seekbar

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.