I have tried different ways to resize the thumb size of Seekbar
but got no success.
This is the thumb of my Seekbar
with pressed effect too:
My thumb selector file where I have added these two images to get press effect:
lessons_thumb_selector:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/lessons_thumb" android:state_pressed="false"/>
<item android:drawable="@drawable/lessons_pressed"/>
</selector>
And my thumb file where I have resized the thumb selector:
thumb_drawable_lessons.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:drawable="@drawable/lessons_thumb_selector"
android:width="50dp"
android:height="50dp"/>
</layer-list>
And my Seekbar
tag in layout file where I have used the Seekbar with this thumb is:
<SeekBar
android:id="@+id/sBarLessons"
android:layout_centerInParent="true"
android:progressDrawable="@drawable/styledprogrees"
android:thumb="@drawable/thumb_drawable_lessons"
style="@style/book_categories_seekbar_style"
/>
And style tag in style.xml file is this:
430dp
175dp
@color/transparent
100
10dp
false
And the problem is! everything looks fine when I see in Android Studio layout preview:
But when i execute and install apk on device it shows thumb size the same and dislocated from Seekbar
:
Note:
- Press effect is working fine.
- Using the same image for 10 inch device and trying to resize it for 7 inch device.
- Please note aligning is not an issue, issue is resizing. I want to reduce the size of thumb proportionately.
- Also generating 9-patch doesn't help in my solution.
- Using Lolipop 5.1.1 version in my devices.
I have tried these solutions too but got no success:
Android SeekBar thumb gets clipped/cut off
dynamically resized Thumb of SeekBar gets clipped above and below, how to draw on top (Z order)?
Android resizing SeekBar thumb width from maximum value