2016-07-28 3 views
1

Пришел в странную ошибку, где текст TextView (login_message) заполняется (имя пользователя), текст которого находится ниже него.TextView заполняется EditText под ним

Прикрепление файла макета.

<?xml version="1.0" encoding="utf-8"?> 
    <LinearLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     xmlns:tools="http://schemas.android.com/tools" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:paddingBottom="@dimen/activity_vertical_margin" 
     android:paddingLeft="@dimen/activity_horizontal_margin" 
     android:paddingRight="@dimen/activity_horizontal_margin" 
     android:paddingTop="@dimen/activity_vertical_margin" 
     android:orientation="vertical" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" 
     tools:showIn="@layout/activity_login"> 
     <TextView 
      android:id="@+id/login_error" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:visibility="invisible"/> 

     <TextView 
      android:id="@+id/login_message" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:textStyle="bold"/> 

     <EditText 
      android:id="@+id/username" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:hint="Enter your username here"/> 
     <EditText 
      android:id="@+id/password" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:inputType="textPassword" 
      android:hint="Enter your password here"/> 
     <Button 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:onClick="login" 
      android:text="Login"/> 
     <Button 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:text="Not a member? Register" 
      android:onClick="goToRegistration"/> 


    </LinearLayout> 

Как отладить/исправить это.

+0

Попробуйте добавить веса для каждого View заказовМои преодолеть перекрытия. – Arshak

+0

Можете ли вы поделиться скриншотом? – Shaishav

+0

Добавить скриншот PLS –

ответ

0

Постарайтесь дать некоторый отвод для имени пользователя сверху.

android:layout_marginTop="5dp" 

Надеюсь, это поможет вам.

0

Попробуйте, как это

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:paddingBottom="@dimen/activity_vertical_margin" 
    android:paddingLeft="@dimen/activity_horizontal_margin" 
    android:paddingRight="@dimen/activity_horizontal_margin" 
    android:paddingTop="@dimen/activity_vertical_margin" 
    android:orientation="vertical" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    > 
    <TextView 
     android:padding="10dp" 
     android:id="@+id/login_error" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:visibility="invisible"/> 

    <TextView 
     android:padding="10dp" 

     android:text="dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd" 
     android:id="@+id/login_message" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textStyle="bold"/> 

    <EditText 
     android:padding="10dp" 

     android:id="@+id/username" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:hint="Enter your username here"/> 
    <EditText 
     android:padding="10dp" 

     android:id="@+id/password" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:inputType="textPassword" 
     android:hint="Enter your password here"/> 
    <Button 
     android:padding="10dp" 

     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:onClick="login" 
     android:text="Login"/> 
    <Button 
     android:padding="10dp" 

     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Not a member? Register" 
     android:onClick="goToRegistration"/> 


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