textview of autocompletetextview showing data in single line

北战南征 提交于 2020-07-24 03:23:13

问题


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.

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

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>

回答1:


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>

my question



来源:https://stackoverflow.com/questions/27508643/textview-of-autocompletetextview-showing-data-in-single-line

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!