Java AutoCompleteTextView可以';t在服务中复制/粘贴
我有一个浮动服务中的AutoCompleteTextView。在java中:Java AutoCompleteTextView可以';t在服务中复制/粘贴,java,android,xml,android-service,autocompletetextview,Java,Android,Xml,Android Service,Autocompletetextview,我有一个浮动服务中的AutoCompleteTextView。在java中: final AutoCompleteTextView editText = mFloatingView.findViewById(R.id.text_box); editText.setFocusableInTouchMode(true); editText.requestFocus(); 在xml中: <AutoCompleteTextView android:id="@+id/link"
final AutoCompleteTextView editText = mFloatingView.findViewById(R.id.text_box);
editText.setFocusableInTouchMode(true);
editText.requestFocus();
在xml中:
<AutoCompleteTextView android:id="@+id/link"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="@color/text"
android:selectAllOnFocus="true"
android:completionThreshold="1"
android:singleLine="true"
android:imeOptions="actionSearch"
android:inputType="textNoSuggestions|textWebEditText"
android:background="@null">
</AutoCompleteTextView>
问题是:
-这两个控制柄不显示
-复制和粘贴按钮不会出现要启用TextView的标准复制/粘贴,请尝试以下操作:
android:textIsSelectable="true"
此外,如果应用程序主题扩展了.NoActionBar主题,则需要启用windowActionModeOverlay:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<item name="windowActionModeOverlay">true</item>
</style>
真的
您是否覆盖了onTouch事件?是的,但不适用于此元素,我检查了所有操作的返回值。覆盖onTouch事件时,这是一个已知问题。因此,您必须自己为textview处理事件。我没有editText元素的ontouch事件侦听器。那么,我能做什么呢?我的应用程序主题:theme.AppCompat.Light.darkaActionBar