Open juziml opened 7 years ago
I have this problem, too. It took me a day, but it didn't work out..
And I try to use
app:kswThumbWidth="18dp" app:kswThumbHeight="18dp"
,
but nothing changed.
Since SwitchButton use kswBackMeasureRatio
to determine how width the background to be drawn with, layout_width
and layout_height
do change the view bounds but SwitchButton will also draw the background and thumb as they were assigned with kswThumbWidth
, kswThumbHeight
and kswBackMeasureRatio
.
If you want to change the real drawn size, use these 3 attributes instead. I'll think about improving the measuring and drawing calculation.
Thanks for your feedback.
Yes, I've already used them
app:kswAnimationDuration="300" app:kswBackDrawable="@drawable/ios_back_drawable" app:kswThumbDrawable="@drawable/ios_thumb_selector" app:kswBackMeasureRatio="1.7" app:kswThumbMarginBottom="-8dp" app:kswThumbMarginLeft="-6dp" app:kswThumbMarginRight="-8dp" app:kswThumbMarginTop="-5dp" app:kswThumbWidth="18dp" app:kswThumbHeight="18dp"
but it's always the same size. It's too big, in my layout. I tried all kinds of ways I could think of it, but ~~
thanks!
===========================================
And I've tried to use setThumbSize
in code, but app has stopped.
Maybe you put your drawable in wrong directory.
OMG!!! You're right!! It works!! It works!! thank you so much!!
You are welcome~
By now, SwitchButton use Drawable's minimal size, usually it's instinct size, to determine the thumb size. May be I should increase the priority of kswThumbWidth
and kswThumbHeight
to override the Drawable's size with them, I'll think about it as well.
Support you, thank you very much for releasing this cool project. It's awesome!
Hi! @kyleduo thanks for excelent switch, its perfect. I have the same issue. I read messages above and found temporary solution with using images with different size. But I think
increase the priority of kswThumbWidth and kswThumbHeight
it will be a perfect idea.
New version has released and I suggest having a try.
Thank you!
when I use layout_width=200dp or layout height=50dp in xml file I realize it's always the same size i changed code in onMeasure method,but is't not work I need you help thanks!