Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
431 views
in Technique[技术] by (71.8m points)

android - How to Make EditText Box Height Expand

Here is my layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <EditText
        android:id="@+id/etTweetReview"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="10dp"
        android:layout_marginLeft="10dp"
        android:layout_marginRight="10dp"
        android:ems="10"
        android:hint="Discuss up to 140 characters"
        android:imeOptions="actionDone"
        android:inputType="textCapSentences"
        android:lines="2"
        android:maxLength="140"
        android:paddingBottom="10dp"
        android:singleLine="false" />

    <Button
        android:id="@+id/theReviewBarButton"
        android:layout_width="200dp"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:layout_marginBottom="5dp"
        android:text="Submit Review"
        android:textSize="22sp" />

    <Spinner
        android:id="@+id/spinnerSort"
        android:layout_width="120dp"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dp"
        android:layout_marginRight="5dp" />

    <ListView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/android:list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="5dp"
        android:scrollbars="none"
        android:layout_marginRight="5dp"
        android:layout_marginTop="8dp" >
    </ListView>

</LinearLayout>

When that EditText box gets to the end, I want it to wrap to the next line. Right now, it just keeps going right moving everything left off screen.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Similar to another question:

Android Word-Wrap EditText text

Here's some example XML code:

<EditText
    android:id="@+id/edtInput"
    android:layout_width="0dip"
    android:layout_height="wrap_content"
    android:layout_weight="1"
    android:hint="@string/compose_hint"
    android:inputType="textCapSentences|textMultiLine"
    android:maxLength="2000"
    android:maxLines="4" />

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...