I have setup a seekbar with a custom thumb image. The initial image is set by XML file and shows fine no cut off. When I make change to image the image gets cut off on the bottom. The seekbar XML is loaded into a framelayout. Seekbar works fine but movement runs past view. So the when I run to max the top gets cut off and when I rum to minimum the bottom gets cut. Both images are the same size.
Here is the initial XML
<SeekBar
android:id="@+id/seekBarr"
android:layout_width="300dp"
android:layout_height="70dp"
android:layout_marginLeft="-100dp"
android:layout_marginTop="230dp"
android:progressDrawable="@drawable/mastersliderback"
android:rotation="270"
android:thumb="@drawable/imgsliderred70" />
here is the code that loads new image.
Drawable thumb1 = getResources().getDrawable( R.drawable.imgsliderred70_rate);
SliderRed.setThumb(thumb1);
I found some additional information on the issue.It was not the image size as I thought but the offset and padding. Here is a the changes I made and the image is no longer clipped.
<SeekBar
android:id="@+id/seekBarr"
android:layout_width="300dp"
android:layout_height="70dp"
android:layout_marginLeft="-100dp"
android:layout_marginTop="230dp"
android:paddingLeft="35dp"
android:paddingRight="35dp"
android:progressDrawable="@drawable/mastersliderback"
android:rotation="270"
android:thumb="@drawable/imgsliderred70"
android:thumbOffset="8dp" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.