2017-01-13 4 views
3

두 줄을 같은 줄, 즉 가로로 사용하여 선형 레이아웃의 모든 가로 공간을 똑같이 확보해야하는 방법. 나는 당신의 EditTexts에서 제거두 줄의 TextInputLayout이 같은 줄에 있습니다.

  <android.support.design.widget.TextInputLayout 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight="0.5"> 

        <EditText 
         android:id="@+id/firstname" 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="0.5" 
         android:hint="@string/fhint" 
         android:inputType="textPersonName" 
         android:maxLength="20" 
         android:maxLines="1" 
         android:elevation="6dp" 
         android:singleLine="true" /> 

       </android.support.design.widget.TextInputLayout> 

       <android.support.design.widget.TextInputLayout 
        android:layout_width="0dp" 
        android:layout_height="match_parent" 
        android:layout_weight="0.5"> 

        <EditText 
         android:id="@+id/lastname" 
         android:layout_width="0dp" 
         android:layout_height="match_parent" 
         android:layout_weight="0.5" 
         android:hint="@string/lhint" 
         android:inputType="textPersonName" 
         android:elevation="6dp" 
         android:maxLines="1" 
         android:maxLength="15" 
         android:singleLine="true" /> 

       </android.support.design.widget.TextInputLayout> 

      </LinearLayout> 

답변

1

무게가 만 TextInputLayout 설정해야 선형 레이아웃을 시도

<android.support.design.widget.TextInputLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="0.5"> 

      <EditText 
       android:id="@+id/firstname" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:hint="@string/fhint" 
       android:inputType="textPersonName" 
       android:maxLength="20" 
       android:maxLines="1" 
       android:elevation="6dp" 
       android:singleLine="true" /> 

     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
      android:layout_width="0dp" 
      android:layout_height="match_parent" 
      android:layout_weight="0.5"> 

      <EditText 
       android:id="@+id/lastname" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:hint="@string/lhint" 
       android:inputType="textPersonName" 
       android:elevation="6dp" 
       android:maxLines="1" 
       android:maxLength="15" 
       android:singleLine="true" /> 

     </android.support.design.widget.TextInputLayout> 
관련 문제