如何使EditText上盒高度展开 [英] How to Make EditText Box Height Expand

查看:109
本文介绍了如何使EditText上盒高度展开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面是我的布局:

<?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>

在那的EditText中获取到最后,我希望它换到下一行。现在,它只是不断去右移一切都不放过屏幕。

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.

推荐答案

已经提出和回答previously。

Already asked and answered previously.

Android的自动换行的EditText文本

示例XML code:

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

这篇关于如何使EditText上盒高度展开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆