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