【问题标题】:Overlap background (and overlap image) on Nexus 5Nexus 5 上的重叠背景(和重叠图像)
【发布时间】:2014-03-18 10:58:39
【问题描述】:

这是我在测试时only get it on Nexus 5 EmulatorOverlap Background (or Overlap Image) problem。我没有在 Nexus 5 设备上测试过,但我认为模拟器应该显示非常正确。

这是我的编码表明如何支持多屏,it works for the others device, not for Nexus 5 emulatorFollowed the answer in here also but it not works.

在我的应用程序中,我使用了Fragment to transfer among pages。当我从第一页(图像中的红色单词)转移到第二页(图像中的蓝色单词)时发生了这种情况。第二页的背景是黑色的,但还是第一页的背景,好诡异。

In /res folder,我用过:

  • /drawable-hdpi 中的中等质量图像。

  • /drawable-xhdpi 中的高质量图像。

  • /drawable-xxhdpi 中的图像质量更高。

  • 也尝试使用不同的布局文件夹,但它不适用于我:将所有文件从 /layout 文件夹复制到 /layout-xhdpi 或 /layout-xxhdpi。

In my manifest.xml file:(虽然定义 screenDensity=445,因为 Nexus 5 的屏幕密度是 445 ppi,但它仍然不起作用)

<compatible-screens>

    <!-- all small size screens -->
    <screen
        android:screenDensity="ldpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="small" />
    <screen
        android:screenDensity="445"
        android:screenSize="small" />
    <screen
        android:screenDensity="480"
        android:screenSize="small" />

    <!-- all normal size screens -->
    <screen
        android:screenDensity="ldpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="normal" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="normal" />
    <!-- Nexus 5 : 445ppi -->
    <screen
        android:screenDensity="445"
        android:screenSize="normal" />
    <screen
        android:screenDensity="480"
        android:screenSize="normal" />
    <!-- all large size screens -->

    <screen
        android:screenDensity="ldpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="large" />
    <screen
        android:screenDensity="445"
        android:screenSize="large" />
    <screen
        android:screenDensity="480"
        android:screenSize="large" />
    <!-- all x large size screens -->

    <screen
        android:screenDensity="ldpi"
        android:screenSize="xlarge" />
    <screen
        android:screenDensity="mdpi"
        android:screenSize="xlarge" />
    <screen
        android:screenDensity="hdpi"
        android:screenSize="xlarge" />
    <screen
        android:screenDensity="xhdpi"
        android:screenSize="xlarge" />
    <screen
        android:screenDensity="445"
        android:screenSize="xlarge" />
    <screen
        android:screenDensity="480"
        android:screenSize="xlarge" />
</compatible-screens>

<supports-screens
    android:anyDensity="true"
    android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:xlargeScreens="true" />

谁知道这个问题,请告诉我,非常感谢。

p/s : 关注 screens_support 但也不起作用。

【问题讨论】:

    标签: android android-layout screen overlap nexus-5


    【解决方案1】:

    all your xml files中,应该给它定义背景颜色,它会解决问题:

    将此android:background="@android:color/black" 添加到您定义的视图标签中。

    p/s : 这个问题是你在项目中使用 Fragment 造成的。

    p/s : 这种情况只能避免背景重叠。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-06-13
      • 1970-01-01
      • 2021-06-15
      • 2020-12-08
      • 1970-01-01
      相关资源
      最近更新 更多