In custom Seekbar, the thumb is overwritten with part of the problem

Source: Internet
Author: User

(Figure I) (figure II) (figure III)

Make a custom Seekbar and change its background image:

[Java]View PlainCopy
  1. <com.android.progress
  2. android:id="@+id/focus_seekbar"
  3. Android:layout_width="Wrap_content"
  4. android:layout_height="Wrap_content"
  5. android:layout_below="@id/seekbar_add"
  6. android:progressdrawable="@drawable/seekbar_img"
  7. android:thumb="@drawable/thumb"
  8. Android:max = "/> "

The definition progressdrawable is the background picture. Thumb as Slider picture

As on the definition XML file, start the program, generate one. The Thumb slider cannot be displayed completely, and part of it is hidden away.

To add a property:

[Java]View PlainCopy
    1. android:thumboffset="0dip"

You can realize that the thumb is not overwritten, that is, the bottom position is three, there is no picture.

There is a vertical verticalseekbar on the net, briefly describe his use:

When the size of the slider is larger than the background below, set the

android:minheight= "19dip"
android:maxheight= "19dip"

19dip is the width of the seek_img picture.

While the Layout_width value of the control is the width and height value of the throne slider

[XHTML]View PlainCopy
  1. <Com.android.VerticalSeek
  2. android:id="@+id/focus_seekbar"
  3. android:layout_width="wrap_content"
  4. android:layout_height="wrap_content"
  5. android:progressdrawable="@drawable/seekbar_img"
  6. android:thumb="@drawable/thumb"
  7. android:thumboffset="0dip"
  8. Android:max = " the"
  9. android:layout_centervertical="true"
  10. android:minheight="19dip"
  11. android:maxheight="19dip"
  12. android:paddingleft=" -15dip"
  13. android:paddingright=" -15dip"/>

Such a small problem, it took me half a day to get out. There are too few resources on the Internet to share with you.

<?xml version= "1.0" encoding= "Utf-8"?>
<layer-list xmlns:android= "Http://schemas.android.com/apk/res/android" >

<item android:id= "@android: Id/background" >
<shape>
<corners android:radius= "5dip"/>
<gradient
Android:startcolor= "#ff364956"
Android:centercolor= "#ff444444"
android:centery= "0.75"
Android:endcolor= "#ff00112e"
Android:angle= "90"
/>
</shape>
</item>

<item android:id= "@android: Id/secondaryprogress" >
<clip>
<shape>
<corners android:radius= "5dip"/>
<gradient
Android:startcolor= "#80364956"
Android:centercolor= "#802f67a6"
android:centery= "0.75"
Android:endcolor= "#8000112e"
Android:angle= "270"
/>
</shape>
</clip>
</item>

<item android:id= "@android: Id/progress" >
<clip>
<shape>
<corners android:radius= "5dip"/>
<gradient
Android:startcolor= "#ff9ee5ff"
Android:centercolor= "#ff9ee5ff"
android:centery= "0.75"
Android:endcolor= "#ff9ee5ff"
Android:angle= "90"
/>
</shape>
</clip>
</item>

</layer-list>

In custom Seekbar, the thumb is overwritten with part of the problem

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.