Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/189.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 我的布局文件有什么问题?文本重叠_Android_Android Layout - Fatal编程技术网

Android 我的布局文件有什么问题?文本重叠

Android 我的布局文件有什么问题?文本重叠,android,android-layout,Android,Android Layout,我的版面中的文本重叠或其他内容,文本被截断我不知道为什么,请帮助我制作一个应用程序,我对XML比较陌生,所以我需要所有内容看起来都一样,然后文本被截断。我还放了一个布局的屏幕截图,这样你就可以看到什么文本被截断了 这是我的XML文件: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/to

我的版面中的文本重叠或其他内容,文本被截断我不知道为什么,请帮助我制作一个应用程序,我对XML比较陌生,所以我需要所有内容看起来都一样,然后文本被截断。我还放了一个布局的屏幕截图,这样你就可以看到什么文本被截断了

这是我的XML文件:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:paddingLeft="0dp"
            android:paddingRight="0dp"
            android:paddingTop="0dp"
            android:paddingBottom="0dp"
            tools:context=".MainMenu"
            android:background="#ffcf688f">

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageView"
    android:src="@drawable/menuimage"
    android:layout_alignBottom="@+id/toBattleButton"
    />

<ImageView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/imageView2"
    android:src="@drawable/menuimage"
    android:layout_alignParentTop="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"/>

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Store"
    android:id="@+id/store"
    android:layout_centerVertical="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"
    android:textColor="@android:color/white"
    android:textSize="60sp"
    />

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="Battle"
    android:id="@+id/battle"
    android:layout_centerVertical="true"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:textColor="@android:color/white"
    android:textSize="60sp"/>

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/toStoreButton"
    android:background="@android:color/transparent"
    android:layout_centerVertical="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true"/>

<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:id="@+id/toBattleButton"
    android:layout_alignTop="@+id/toStoreButton"
    android:layout_alignParentRight="true"
    android:layout_alignParentEnd="true"
    android:layout_alignParentBottom="true"
    android:layout_alignLeft="@+id/battle"
    android:layout_alignStart="@+id/battle"
    android:background="@android:color/transparent"
    android:singleLine="false"/>

<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@+id/imageView2"
    android:layout_centerHorizontal="true"
    android:weightSum="5"
    android:paddingBottom="15dp">

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Text"
            android:id="@+id/menuText1"
            android:editable="true"
            android:textSize="20sp"
            android:textColor="#ff9cf8ff"
            android:textAlignment="center"
            android:layout_gravity="center"
            />
    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Text"
            android:id="@+id/menuText2"
            android:textSize="20sp"

            android:textColor="#ff9cf8ff"
            android:layout_gravity="center"
            android:textAlignment="center"
            />
    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Text"
            android:id="@+id/menuText3"
            android:textSize="20sp"

            android:textColor="#ff9cf8ff"
            android:layout_gravity="center"
            android:textAlignment="center"
            />
    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Text"
            android:id="@+id/menuText4"
            android:textSize="20sp"

            android:textColor="#ff9cf8ff"
            android:layout_gravity="center"
            android:textAlignment="center"
            />
    </LinearLayout>

    <LinearLayout
        android:orientation="vertical"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_weight="1">

        <TextView
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="New Text"
            android:id="@+id/menuText5"
            android:textSize="20sp"

            android:textColor="#ff9cf8ff"
            android:layout_gravity="center"
            android:textAlignment="center"
            android:paddingTop="1dp"/>
    </LinearLayout>

</LinearLayout>


尝试使用LinearLayout而不是RelativeLayout。

尝试使用LinearLayout而不是RelativeLayout。

如果希望元素一个接一个地在相对布局中使用此属性

 android:layout_below = "@+id/aboveElementId"

如果希望元素一个接一个地排列,请在相对布局中使用此属性

 android:layout_below = "@+id/aboveElementId"

您的布局嵌套在不需要的地方

仔细阅读,了解没有必要为每个TextView设置线性布局。您应该意识到,您试图实现的目标可以通过一个
线性布局
、两个
空格
s和多个
文本视图
s来实现。大概是这样的:

<LinearLayout
    android:orientation="vertical"
    android:background="@drawable/menuimage"
    ...>

<Space
    android:weight="1"
    .../>

<TextView
    .../>

<Space
    android:weight="1"
    .../>

<TextView
    .../>
<TextView
    .../>
<TextView
    .../>
<TextView
    .../>
<TextView
    .../>
</LinearLayout>

您的布局嵌套在不需要的地方

仔细阅读,了解没有必要为每个TextView设置线性布局。您应该意识到,您试图实现的目标可以通过一个
线性布局
、两个
空格
s和多个
文本视图
s来实现。大概是这样的:

<LinearLayout
    android:orientation="vertical"
    android:background="@drawable/menuimage"
    ...>

<Space
    android:weight="1"
    .../>

<TextView
    .../>

<Space
    android:weight="1"
    .../>

<TextView
    .../>
<TextView
    .../>
<TextView
    .../>
<TextView
    .../>
<TextView
    .../>
</LinearLayout>