我正在使用一台自动完成。我想把这个自动完成显示为一个多行。我不想将下拉列表显示为多行,但我想将文本框显示为多行。
我还在.xml文件中使用了multiline属性,但是它在键盘上显示了nextline键,我不想使用用户来按下这个键并继续下一行。
现在发生了什么
我正在输入文本框后,完成空间,它是水平滚动。并在一行中显示所有文本。
我想要什么
假设用户键入并完成textbox的空格后,光标将自动转到下一行,这样用户就可以一次看到所有文本,而无需水平滚动。
这是我的密码。
<AutoCompleteTextView
android:id="@+id/txtTags"
android:layout_width="fill_parent"
android:layout_height="44dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:background="@drawable/borderforloginedittext"
android:gravity="center_vertical"
android:hint="eg: Breakfast, spicy, italian "
android:inputType="textPersonName|textImeMultiLine"
android:imeOptions="actionSearch"
android:paddingLeft="70dp"
android:scrollHorizontally="false"
android:verticalScrollbarPosition="right"
android:dropDownHeight="fill_parent"
android:dropDownWidth="match_parent"
android:textColor="#333333"
android:textColorHint="#999999"
android:textSize="16sp" >
</AutoCompleteTextView> 我需要一个行动搜索弹劾选项,这样用户就可以按下键盘的搜索键。这就是为什么我不能使用textmultiline,因为它将搜索键替换为下一行键。
请提供一些参考或提示。
发布于 2014-01-06 06:12:36
我没有找到任何答案。因为我想使用imeoption作为actionSearch,然后我希望我的自动完成功能能够像多行EditText那样运行。
因此,我删除actionsearch作为ime选项并放置多行。这不是我想要的,但至少能让我满意50%。
<AutoCompleteTextView
android:id="@+id/txtTags"
android:layout_width="fill_parent"
android:layout_height="44dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:background="@drawable/borderforloginedittext"
android:hint="eg: Breakfast, spicy, italian "
android:inputType="textPersonName|textMultiLine"
android:paddingLeft="70dp"
android:dropDownHeight="fill_parent"
android:dropDownWidth="match_parent"
android:textColor="#333333"
android:textColorHint="#999999"
android:textSize="16sp" >
</AutoCompleteTextView> 这段代码为我提供了一个使用多行的选项。
发布于 2013-12-26 09:44:30
在xml中执行以下更改。
<AutoCompleteTextView
android:id="@+id/txtTags"
<!--remove below width as fill_parent and set fixed width as per your need-->
android:layout_width="fill_parent"
android:layout_height="44dip"
android:layout_marginLeft="12dip"
android:layout_marginRight="12dip"
android:background="@drawable/borderforloginedittext"
android:gravity="center_vertical"
android:hint="eg: Breakfast, spicy, italian "
<!-- please replace textImeMultiLine with textMultiLine.-->
android:inputType="textPersonName|textImeMultiLine"
android:imeOptions="actionSearch"
android:paddingLeft="70dp"
android:scrollHorizontally="false"
android:verticalScrollbarPosition="right"
android:dropDownHeight="fill_parent"
android:dropDownWidth="match_parent"
android:textColor="#333333"
android:textColorHint="#999999"
android:textSize="16sp" >
</AutoCompleteTextView>发布于 2018-08-13 11:42:07
它如此简单,你只需要设置
android:singleLine="false"https://stackoverflow.com/questions/20781991
复制相似问题