Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android RelativeLayout在实际设备上显示不正确_Android_Xml_Android Layout_Android Relativelayout - Fatal编程技术网

Android RelativeLayout在实际设备上显示不正确

Android RelativeLayout在实际设备上显示不正确,android,xml,android-layout,android-relativelayout,Android,Xml,Android Layout,Android Relativelayout,我有一个关于Android RelativeLayout的问题。我的布局在仿真器上运行良好,仿真器的配置类似于LG Nexus4(屏幕,分辨率)。但是如果我在真正的Nexus4上运行应用程序,它会出现严重错误,我不知道如何修复它们 以下是我的布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"

我有一个关于Android RelativeLayout的问题。我的布局在仿真器上运行良好,仿真器的配置类似于LG Nexus4(屏幕,分辨率)。但是如果我在真正的Nexus4上运行应用程序,它会出现严重错误,我不知道如何修复它们

以下是我的布局:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/mainMenuLayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ImageView
        android:id="@+id/zeekedLogo"
        android:contentDescription="@string/logo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentRight="true"
        android:layout_marginBottom="24dp"
        android:layout_marginRight="24dp"
        android:src="@drawable/badge" />

    <TextView
        android:id="@+id/textButtonPlay"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="56dp"
        android:text="@string/menu_play"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textButtonResume"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/textButtonPlay"
        android:layout_centerHorizontal="true"
        android:layout_marginTop="20dp"
        android:text="@string/menu_resume"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/textLabelLevel"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_above="@+id/zeekedLogo"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="54dp"
        android:text="@string/menu_level"
        android:textAppearance="?android:attr/textAppearanceMedium" />

    <TextView
        android:id="@+id/textButtonSound"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignBottom="@+id/zeekedLogo"
        android:layout_marginLeft="24dp"
        android:text="@string/menu_sound_on"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</RelativeLayout>

以下是相同布局的屏幕截图:

仿真器:

Nexus 4:


提前谢谢

将背景色添加到我的relativelayout后,它对我的Nexus4起作用。这就是我所做的一切。。。我觉得这很奇怪。但最后,我很高兴它能起作用。

有人对这个问题有想法吗?我可以问一下为什么我们不能看到简历文本视图吗?文本视图在代码->txtView.setVisibility(View.go)中设置为gone,似乎没有任何依赖性。你有没有试着把它改成隐形,看看会发生什么?不过,我只是随机给出一些建议,因为我真的不知道为什么会发生这种情况。谢谢@Hbibna的建议,我检查了一下,但没什么区别:(