Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - multiple EditText fields in window resize

In one of my views, I have three EditText fields. The first two are single-line, and the third is multi-line. I'm using android:windowSoftInputMode="stateVisible|adjustResize". however the third field collapses far too small in portrait mode when the IME comes up and it has focus.

Is there an option to set a minimum height that would force the window to scroll down to accommodate the third field?

I have tried setting android:minHeight="20dip" in the xml file, but this has no effect.

The EditText in question looks like:

<EditText 
        android:id="@+id/msgreplyarea"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" android:gravity="top"
        android:layout_weight="1"
        android:layout_marginLeft="10dip" android:layout_marginRight="10dip"
        android:layout_marginTop="10px" 
        android:inputType="textCapSentences|textMultiLine"
        android:imeOptions="flagNoEnterAction">

Thanks.

like image 911
aperture Avatar asked Apr 29 '11 22:04

aperture


1 Answers

android:minHeight does work, but the parent view needs to be wrapped in a ScollView

<ScrollView
  android:layout_width="fill_parent"
  android:layout_height="0dip"
  android:layout_weight="1"
  android:scrollbarStyle="outsideInset"
  android:fillViewport="true">
    <LinearLayout
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:orientation="vertical" >
        <EditText 
          android:id="@+id/replyarea"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content" android:gravity="top"
          android:singleLine="false" android:layout_weight="1"
          android:layout_marginLeft="10dip" android:layout_marginRight="10dip"
          android:layout_marginTop="10px"
          android:minHeight="120dp"
          android:inputType="textAutoCorrect|textCapSentences|textMultiLine"
          android:imeOptions="flagNoEnterAction" />
    </LinearLayout>    
</ScrollView>
like image 50
aperture Avatar answered Oct 30 '22 17:10

aperture