2017-12-13 3 views
0
<ScrollView 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:id="@+id/scrollView" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fillViewport="true"> 

<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="wrap_content" 
    tools:context="com.example.salu.xyz.SurroundingsPropertyFragment"> 


    <android.support.constraint.ConstraintLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_margin="10dp"> 

     <TextView 
      android:id="@+id/textView77" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 

      android:layout_marginTop="16dp" 
      android:text="Property Surroundings:" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintTop_toTopOf="parent" 
      android:textSize="20sp"/> 

     <EditText 
      android:id="@+id/editText55" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="16dp" 
      android:ems="10" 
      android:inputType="textMultiLine" 
      app:layout_constraintBaseline_toBaselineOf="@+id/textView77" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toTopOf="parent" /> 

     <TextView 
      android:id="@+id/textView78" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="32dp" 
      android:text="Class Of Locality:" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/textView77" 
      android:textSize="20sp"/> 

     <Spinner 
      android:id="@+id/spinner9" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      app:layout_constraintBaseline_toBaselineOf="@+id/textView78" 
      app:layout_constraintEnd_toEndOf="parent" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintStart_toStartOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/editText55" /> 

     <TextView 
      android:id="@+id/textView79" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="32dp" 
      android:text="Proximities to Civic Amenities:" 
      app:layout_constraintLeft_toLeftOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/textView78" 
      android:textSize="20sp"/> 

     <EditText 
      android:id="@+id/editText57" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      app:layout_constraintBaseline_toBaselineOf="@+id/textView79" 
      android:layout_marginTop="20dp" 
      android:ems="10" 
      android:inputType="textPersonName" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/spinner9" /> 

     <TextView 
      android:id="@+id/textView80" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_marginTop="32dp" 
      android:text="Neighbourhood:" 
      app:layout_constraintStart_toStartOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/textView79" 
      android:textSize="20sp"/> 

     <EditText 
      android:id="@+id/editText58" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      app:layout_constraintBaseline_toBaselineOf="@+id/textView80" 
      android:ems="10" 
      android:inputType="textPersonName" 
      app:layout_constraintRight_toRightOf="parent" 
      app:layout_constraintTop_toBottomOf="@+id/editText57" /> 

    </android.support.constraint.ConstraintLayout> 
</LinearLayout> 
</ScrollView> 

こんにちはとアンドロイドのTextViewの重複を避けるためか、私はTextViewEditTextの両方を持っているFragmentでフォームを作成していますし、私は5インチの画面のためにそれをテストしていた、Androidのアプリケーション開発に新たなんですTextViewEditTextが重複しています。はどのように私はのEditText

サイズを変更するためにウィジェットを試しましたが、画面サイズが大きくなるとアライメントが悪くなります。

これを修正または回避する方法はありますか?

答えて

0

linearlayout(フォーム用)RelativeLayout。このような操作を行うと、すべての端末でフォームが正常に機能します。

<ScrollView 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:id="@+id/scrollView" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:fillViewport="true"> 

<RelativeLayout 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="wrap_content" 
    tools:context="com.example.salu.libravaluation.SurroundingsPropertyFragment"> 


    <LinearLayout 
     android:id="@+id/ll1" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:orientation="horizontal" 
     android:layout_marginBottom="10dp"> 

     <TextView 
      android:id="@+id/textView77" 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="1" 
      android:text="Property Surroundings:" 
      android:textSize="20sp" /> 

     <EditText 
      android:id="@+id/editText55" 
      android:layout_width="0dp" 
      android:layout_height="wrap_content" 
      android:layout_weight="1" 
      android:ems="10" 
      android:inputType="textMultiLine" /> 

    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/ll2" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/ll1" 
     android:orientation="horizontal" 
     android:layout_marginBottom="10dp"> 

     <TextView 
      android:id="@+id/textView78" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" 
      android:text="Class Of Locality:" 
      android:textSize="20sp" /> 

     <Spinner 
      android:id="@+id/spinner9" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" /> 

    </LinearLayout> 


    <LinearLayout 
     android:id="@+id/ll3" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/ll2" 
     android:orientation="horizontal" 
     android:layout_marginBottom="10dp"> 

     <TextView 
      android:id="@+id/textView79" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:gravity="center|start" 
      android:layout_height="match_parent" 
      android:text="Proximities to Civic Amenities:" 
      android:textSize="20sp" /> 

     <EditText 
      android:id="@+id/editText57" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="match_parent" 
      android:layout_marginTop="20dp" 
      android:ems="10" 
      android:inputType="textPersonName" 
      app:layout_constraintBaseline_toBaselineOf="@+id/textView79" /> 

    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/ll4" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/ll3" 
     android:orientation="horizontal" 
     android:layout_marginBottom="10dp"> 

     <TextView 
      android:id="@+id/textView80" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" 
      android:text="Neighbourhood:" 
      android:textSize="20sp" /> 

     <EditText 
      android:id="@+id/editText58" 
      android:layout_width="0dp" 
      android:layout_weight="1" 
      android:layout_height="wrap_content" 
      android:ems="10" 
      android:inputType="textPersonName" /> 

    </LinearLayout> 
</RelativeLayout> 
</ScrollView>