Ten slider controls (slider bar)

Source: Internet
Author: User

Study notes, please correct me if you have any mistakes. The number is also please point out, thank you.

The slider is made up of 4 parts: Slider (Body), Background (background), fill (fill), and handle (slide handle)

Fill rect: Fills the area, fills the rect Transform, usually the image element

Handle rect: Drag handle, filled with rect Transform, typically an image element

Direction: direction, with LeftToRight (from left to right) RightToLeft (right to left), TopToBottom (top to bottom) and bottomtotop (bottom to top)

Min Value: Minimum

Max value: Max

Whole Numbers: Whether to limit to integers

Value: Current value

Volume text
Public Text volume;
Slide Bar
Public slider slider;
Default Volume
float startvolume = 0.5f;
void Start ()
{
Start by assigning the default volume to sliders and text
Volume.text = Startvolume.tostring ();
Slider.value = Startvolume;
}
public void Onpress_slider ()
{
When sliding the slider bar, assign the most recent value to volume and set the string to 2 decimal places
Volume.text = slider.value.ToString ("F2");
}

Slider Component Split (script):1:background Background 2:fill area fill (empty object) Fill (image) 3:handle Slide zone: Slider (empty object) handle (image) Fill rect: Fills the rectangular region (which is optional Fill others) Handle Rect: Handle rectangular Area direction: Handle direction

Min value: Min value max value: Maximum value whole Numbers: integer value: Tick on whole Numbers after value value is integer values: numeric value (minus handle becomes pure progress bar) event: On value Changed event. Public Text Text_displayvalue;
public void Display_slider (float flovalue)
{
Text_displayvalue.text = Flovalue.tostring ();
The script hangs empty to the image, more flexible navigation

Ten slider controls (slider 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.