Reputation: 659
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);
Upvotes: 1
Views: 3397
Reputation: 1167
gradle.build
under root directoryclasspath 'com.android.tools.build:gradle:4.2.2'
sync now
option (if no such option exists then try a different answer)And just like magic it suddenly works
Upvotes: 0
Reputation: 659
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" />
Upvotes: 4