2011-04-29 57 views
5

Trong một chế độ xem của tôi, tôi có ba trường EditText. Hai cái đầu tiên là một dòng, và dòng thứ ba là nhiều dòng. Tôi đang sử dụng android:windowSoftInputMode="stateVisible|adjustResize" tuy nhiên trường thứ ba sụp đổ quá nhỏ trong chế độ dọc khi IME xuất hiện và nó có tiêu điểm.Android - nhiều trường EditText trong cửa sổ đổi kích thước

Có tùy chọn để đặt chiều cao tối thiểu có thể buộc cửa sổ cuộn xuống để phù hợp với trường thứ ba không?

Tôi đã thử đặt android:minHeight="20dip" trong tệp xml, nhưng điều này không có hiệu lực.

EditText được đề cập trông giống như:

<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" />

Cảm ơn.

Trả lời

2

android: minheight làm việc, nhưng quan điểm cha mẹ cần phải được bọc trong một 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> 
0

Android documentation có thể giúp bạn với điều này. Hoặc bạn có thể sử dụng một sửa chữa nhanh chóng:

<activity name="EditContactActivity" 
    android:windowSoftInputMode="stateVisible|adjustResize"> 
    ... 
</activity> 

HOẶC

android:windowSoftInputMode="adjustPan" 
+0

bạn sẽ nhận thấy trong câu hỏi của tôi, tôi xác định rằng tôi đã sử dụng nó. – aperture

Các vấn đề liên quan