开发者

How to resize the image inside a button?

开发者 https://www.devze.com 2023-03-18 15:00 出处:网络
I\'m creating a proportional UI, the thing is that - by different UI resolutions the UI-components get different shapes. I\'m using image-text button, which for different resolutions have different di

I'm creating a proportional UI, the thing is that - by different UI resolutions the UI-components get different shapes. I'm using image-text button, which for different resolutions have different dimensions. Could I do so, that开发者_如何学Python the image inside the button resize also proportional depending on button's width/height? (currently the image doesn't change its dimensions and just some parts of it are hidden).

Here is the xml-sorce, I'm using for such kind of button:

<Button
    android:id="@+id/today"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:drawableTop="@drawable/today"
    android:drawablePadding="0sp"
    android:gravity="center_horizontal|bottom"
    android:textSize="8sp"
    android:text="@string/today"
    android:onClick="getRSSNews"
    />


Try to create mdpi and ldpi drawables too (with same name) and see how will that work.

0

精彩评论

暂无评论...
验证码 换一张
取 消