如果我使用 fill_vertical
或者 fill_horizontal
,我该如何保持宽高比?在这段代码中:
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/_toogle_green"
android:gravity="bottom|fill_vertical"
/>
位图在垂直方向上填充正常,但在水平方向上保持原始宽度,且纵横比被破坏。
我相信这个问题已经被问过了,但我真的找不到,只有针对ImageView或ImageButton的解决方案。但我需要在可绘制对象中实现这个效果。