autocompletetextview的textview以单行显示数据 [英] textview of autocompletetextview showing data in single line

查看:193
本文介绍了autocompletetextview的textview以单行显示数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获取类似于图像的自动完成文本视图的文本视图( http://1.bp.blogspot.com/_I2Ctfz7eew4/S-fuCsktkaI/AAAAAAAAAZw/31QDXkXQ_Yc/s1600/AutoCompleteTextView2.1.PNG ).我希望当文本的长度超出宽度时,textview的高度必须扩大.

I am getting textview of my autocompletetextview like image (http://1.bp.blogspot.com/_I2Ctfz7eew4/S-fuCsktkaI/AAAAAAAAAZw/31QDXkXQ_Yc/s1600/AutoCompleteTextView2.1.PNG). I want that heigth of textview must expand when length of the text goes out of the width.

我的autocompletetextview代码为:

My autocompletetextview code is:

<AutoCompleteTextView 
             android:layout_width="0dip"
            android:layout_weight="3.5"
            android:layout_height="40dp"
            android:ems="10"
            android:padding="5dp"
            android:imeOptions="actionNext"
            android:layout_marginLeft="7dp" 
            android:background="@drawable/edittext_frame"
            android:textSize="16dp"
/>

我的Textview代码是

My Textview code is

<TextView
    xmlns:android="http://schemas.android.com/apk/res/android"
    style="?android:attr/spinnerItemStyle"
    android:layout_width="50dp"
    android:layout_height="wrap_content"
    android:paddingTop="8sp"
    android:paddingBottom="8sp"
    android:gravity="center_vertical"
    android:textSize="14sp">
</TextView>

推荐答案

只需使用LinearLayout包装TextVidw:

Just use a LinearLayout to wrap TextVidw:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/tv_search"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="4dp"
    android:paddingBottom="4dp"
    android:singleLine="false"
    android:textColor="#000000"
    android:textSize="16dp"
    tools:text="test--------------------------------------test" />
 </LinearLayout>

我的问题

这篇关于autocompletetextview的textview以单行显示数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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