2015-10-30 2 views
1

Мои тексты в моих макетах перекрываются или что-то в этом роде, и текст отключен. Я не уверен, почему, пожалуйста, помогите, я делаю приложение, и я относительно не знаком с 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> 

I cant figure out why the text is cut off at the bottom (in blue)

ответ

0

Попытка использования LinearLayout вместо RelativeLayout.

0

Если вы хотите, чтобы элементы один за другим использовать этот атрибут в относительном макете

android:layout_below = "@+id/aboveElementId" 
0

Ваш макет вложен, где это не должно быть.

Хорошо прочитайте this article, чтобы понять, что для каждого TextView необязательно иметь LinearLayout. Вы должны понимать, что то, что вы пытаетесь выполнить, может быть сделано с помощью одного LinearLayout, двух Space и, однако, многих Textview. Что-то вроде этого:

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

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

<TextView 
    .../> 

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

<TextView 
    .../> 
<TextView 
    .../> 
<TextView 
    .../> 
<TextView 
    .../> 
<TextView 
    .../> 
</LinearLayout> 
Смежные вопросы