如何使 EditText 框高度扩大 [英] How to Make EditText Box Height Expand

查看:36
本文介绍了如何使 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.

推荐答案

类似另一个问题:

Android Word-Wrap EditText 文本

这是一些示例 XML 代码:

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

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

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