0

我在 Android 4.2 及更高版本上有一个奇怪的错误。我有一个自定义视图(它是经典的 RelativeLayout,而不是来自外部库的小部件),它在严格低于 4.2 的 Android 版本上看起来像这样(正常外观):

我的视图的正常外观

但在 Android 4.2 及更高版本上看起来像这样(白色背景 = 错误):

越野车外观

有谁知道可能是什么原因?我记得我从我的项目中删除了一些 holo.theme 文件,因为我认为主题无用,我不明白为什么会这样,只是为了提供完整的信息。

有关信息,我直接在 xml 中设置背景,如下所示:

 <ImageView
            android:id="@+id/woodOfTopBarImageView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:scaleType="fitXY"
            android:layout_alignTop="@+id/topBarButtonsRelativeLayout"
             android:layout_alignBottom="@+id/topBarButtonsRelativeLayout"
            android:src="@drawable/topbaripad3_2x"
             />

谢谢 !!

4

1 回答 1

0

我发现了问题:似乎在 Android 4.2 及更高版本上,如果图像太大(比屏幕大和/或高得多),则图像大小调整(按比例缩小)无法正常工作。我放了一个较小的源图像,它可以工作。

于 2013-11-27T14:20:22.933 回答