2016-07-06 6 views
-1

残りのLinearlayout(下のコード)をEdittext で埋めたいのですが、weightプロパティを使わずにどうすればいいのでしょうか?タイトル(下の画像) はそれは?残りのLinearlayoutをEdittext(Androidスタジオ)で埋めてください

This is the Picture (Red part)

コード:

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

    <LinearLayout 
     android:id="@+id/viewA" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight="0.6" 
     android:background="@android:color/holo_purple" 
     android:orientation="horizontal"> 

     <ImageView 
      android:id="@+id/image" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fitsSystemWindows="true" 
      android:scaleType="centerCrop" 
      android:src="@drawable/splash_image" /> 
    </LinearLayout> 

    <LinearLayout 
     android:id="@+id/viewB" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:layout_weight="0.4" 
     android:orientation="horizontal"> 
     <android.support.design.widget.TextInputLayout 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:padding="20dp"> 

      <AutoCompleteTextView 
       android:id="@+id/Title" 
       android:layout_width="match_parent" 
       android:layout_height="wrap_content" 
       android:hint="Title" 
       android:inputType="textShortMessage" 
       android:maxlines="1" 
       android:singleLine="true" 
       android:maxLength="10" 
       /> 
     </android.support.design.widget.TextInputLayout> 

     <android.support.design.widget.TextInputLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_ 
      android:padding="10dp"> 

      <EditText 

       android:layout_width="match_parent" 
       android:layout_height="match_parent" 
       android:id="@+id/Textext" 
       android:hint="text" 
       android:inputType="textShortMessage" 
       android:maxlines="1" 
       android:singleLine="true" 
       android:maxLength="10"/> 

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

</LinearLayout> 

<android.support.design.widget.FloatingActionButton 
    android:id="@+id/fab" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_margin="16dp" 
    android:clickable="true" 
    android:src="@drawable/ic_done" 
    app:layout_anchor="@id/viewA" 
    app:layout_anchorGravity="bottom|right|end"/> 

+1

'layout_weight'を使用するか、' LinearLayout'以外のものを使うか、Javaでいくつかの厄介な計算を行って自分でサイズを調整しようとします。この場合に 'layout_weight'を使うことに対するあなたの具体的な反対は何ですか? – CommonsWare

+0

Linearlayoutの向きを水平に設定し、垂直に変更し、edittextの高さをmatch_parentに設定すると問題が解決します。これで希望の解決策が得られますように..... – Bhavnik

答えて

0

親TextInputViewはラップコンテンツです。親に一致するように設定します。それ以外の場合は、塗りつぶさずにラップされたeditTextを塗りつぶすだけです。

関連する問題