Usage Summary of seekbar of Android control

1 Introduction to seekbar

Seekbar is the progress bar. When we use the progress bar, we can use the default progress bar of the system; You can also customize the picture of progress bar and slider picture.

2 seekbar example

Create an activity containing 2 seekbars.

The first seekbar is the system default seekbar.

The second seekbar is a custom seekbar, which uses a custom background image and slider image.

Application layer code

Code Description:

To listen to the sliding message of seekbar, implement the "seekbar. Onseekbarchangelistener" interface. This interface contains three methods onstarttrackingtouch(), onstoptrackingtouch() and onprogresschanged().

Layout file

The background definition of the custom seekbar is: Android: progressdrawable = "@ drawable / bg_bar".

It calls BG_ The contents of bar.xml are as follows:

bar_ Dn.png is shown in the figure below:

bar_ Up.png is shown in the figure below:

The slider definition of custom seekbar is: Android: thumb = "@ drawable / thumb_bar".

It calls the thumb_ The contents of bar.xml are as follows:

thumb_ Up.png is shown in the figure below:

thumb_ Dn.png is shown in the figure below:

Manifest file

Click download: source code

Operation effect: as shown in the figure

The above is the whole content of this article. I hope it will be helpful to your study, and I hope you can support programming tips.

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>