我尝试为标签内容使用背景 (480x320)。使用 xml 作为可绘制对象,我应该能够缩放图像。这在 tabhost/tabactivity 之外工作正常。如果我尝试在 tabcontent 中使用它,则 scaleType 不起作用。他忽略了我尝试过的每一个 scaleType。
标签内容:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/background">
<include layout="@layout/main_list" />
</RelativeLayout>
res/drawable 中的 background.xml
<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:src="@drawable/background_img"
android:scaleType="centerInside"/>
当然,我通过更改图像检查了 xml 是否真的被使用,在图像更改时使用了 xml。
使用的缩放比例似乎是 fitXY,因为整个背景都是可见的,但纵横比被忽略了。
一些想法?