1

我的摩托罗拉 Defy Plus 设备出现了一个奇怪的问题。

我得到了一个带有 TabHost 的简单布局,其中包含一个 ImageView 作为其中所有选项卡的背景图像。

出于某种奇怪的原因,特别是在 Motorola Defy 上,ImageView 显示为黑色!但在我测试过的所有其他设备上,它运行良好!(三星 Galaxy SII、Galaxy Mini、Nexus 7)

该图像是一个常规的 .jpg 文件,大小为 102KB,大小为 1330X1774。它位于 res\drawable 文件夹中。它的名字是——“blurtest_cropped2.jpg”

.xml 布局文件如下 -

<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@android:id/tabhost"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <ImageView
            android:id ="@+id/main_background_imageview" 
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:src="@drawable/blurtest_cropped2"
            android:scaleType="centerCrop"
            />
    <LinearLayout
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
        <TabWidget
            android:id="@android:id/tabs"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content" />
        <!--  Required for TabWidget -->
        <FrameLayout
            android:id="@android:id/tabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent" />
    </LinearLayout>
</TabHost>

谢谢!

4

1 回答 1

4

摩托罗拉 Defy 的图像分辨率可能太高。如果您不想降低其他设备的分辨率,只需将较低分辨率的图像放在针对较小/低密度屏幕的可绘制文件夹中。

我最近在我的华为 Ideos X5 上遇到了类似的问题。我在同一个屏幕上有 2 个 ImageView,一个很好,另一个是黑色的。我注意到挑衅图像的分辨率明显高于其他图像。降低该图像的分辨率后,果然,挑衅的图像将不再挑战我。

*对不起,我太喜欢使用“Defy”这个词了。

于 2012-11-05T13:53:17.140 回答