简体   繁体   English

Nexus 5上的重叠背景(和重叠图像)

[英]Overlap background (and overlap image) on Nexus 5

This is the Overlap Background (or Overlap Image) problem which I only get it on Nexus 5 Emulator while testing. 这是Overlap Background (or Overlap Image) problem ,我在测试时only get it on Nexus 5 Emulator I have not tested on Nexus 5 Device, but I think the Emulator should show quite correct. 我尚未在Nexus 5设备上进行测试,但我认为模拟器应该显示正确。

重叠背景或重叠图像

This is my coding indicated how to support multiple screen, it works for the others device, not for Nexus 5 emulator . 这是我的编码,表明如何支持多屏幕, it works for the others device, not for Nexus 5 emulator Followed the answer in here also but it not works . 在这里也遵循了答案,但没有用

In my application, I used Fragment to transfer among pages . 在我的应用程序中,我使用Fragment to transfer among pages It happened when I transfer from first page (red words in image) to second page (blue words in image). 当我从第一页(图像中的红色单词)转移到第二页(图像中的蓝色单词)时,发生了这种情况。 Background of second page is Black, but it still so Background of first page, it's so strange. 第二页的背景为黑色,但仍然如此。第一页的背景非常奇怪。

In /res folder , I used : In /res folder ,我使用了:

  • Medium quality image in /drawable-hdpi . /drawable-hdpi中的中等质量图像。

  • High quality image in /drawable-xhdpi . /drawable-xhdpi高质量图像。

  • Higher quality image in /drawable-xxhdpi . /drawable-xxhdpi高质量图像。

  • Also tried with different layout folder, but it not works for me : copy all files from /layout folder to /layout-xhdpi or /layout-xxhdpi. 也尝试过使用其他布局文件夹,但对我不起作用:将所有文件从/ layout文件夹复制到/ layout-xhdpi或/ layout-xxhdpi。

In my manifest.xml file : (Although defined screenDensity=445 since Nexus 5 has screen density is 445 ppi, it still not works) 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" />

Who know this problem, please tell me, Thanks so much. 谁知道这个问题,请告诉我,非常感谢。

p/s : Followed screens_support but not works also. p / s:遵循screens_support,但也不起作用

In all your xml files , should define the background color for it, it will solve the problem : all your xml files ,应为其定义背景颜色,这将解决问题:

Add this android:background="@android:color/black" in to the View tag you defined. 将此android:background="@android:color/black"到您定义的View标记中。

p/s : This problem happened from you use Fragment in the project. p / s:此问题是由于您在项目中使用Fragment而发生的。

p/s : This case only avoid Background was overlapped. p / s:这种情况只能避免背景重叠。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM