TextView can't change line In AutoCompleteTextView DropDownListVIew

给你一囗甜甜゛ 提交于 2021-01-29 16:53:53

问题


I tested on Android Api 28.

I added a AutoCompleteTextView and it showed like below:

I have try:

1.setting lines =3,maxLines = 3,scrollHorizontally = true,inputType="textMultiLine",singleLine =true,and it made no change.

2.setting LayoutParams,and it showed like below:

.

similar case:textview of autocompletetextview showing data in single line


回答1:


Just need a LinerLayout to wrap the TextView in the layout of item:

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


来源:https://stackoverflow.com/questions/62651287/textview-cant-change-line-in-autocompletetextview-dropdownlistview

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