问题
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