问题描述
当用户在Web视图中单击其他位置(浮动按钮)时,我试图隐藏文本选择手柄,如图像所示,这些手柄与我的线性布局重叠. layout_meaning_selected_text
是我在选择并单击按钮后隐藏并显示的元素.
I'm trying to hide the text selection handles when the user clicks somewhere else (a floating button) in webview, as shown in images the handles overlap with my linear layout. layout_meaning_selected_text
is the element I hide and show after selection and clicking on the button.
关于如何解决这种重叠的任何想法,我希望选择文本,只是我要专注于该黄色部分,然后将其关闭,然后专注于所选文本.
any idea how to resolve this overlapping, and I want the text to be selected, it's just I want to make focus on that yellow part and after closing that, focus on the selected text.
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.myview.HorizontalWebView
android:id="@+id/web_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbars="none"
tools:layout_editor_absoluteX="10dp"
tools:layout_editor_absoluteY="10dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"/>
<View
android:layout_width="@dimen/afc_200dp"
android:layout_height="@dimen/afc_200dp"
android:layout_centerInParent="true"
android:background="@drawable/watermark_logo_grey" />
<include
android:id="@+id/selection_panel"
layout="@layout/custom_popup_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/afc_10dp"
android:visibility="gone"
tools:visibility="visible" />
<include
android:id="@+id/layout_editbookmark"
layout="@layout/toast_with_icon"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_margin="@dimen/afc_10dp"
android:visibility="gone" />
<include
android:id="@+id/search_panel"
layout="@layout/search_panel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_margin="@dimen/afc_10dp"
android:visibility="gone" />
<include layout="@layout/config_layout" />
<include
android:id="@+id/layout_meaning_selected_text"
layout="@layout/layout_meaning_selected_text"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_alignParentBottom="true" />
</RelativeLayout>
推荐答案
您必须在黄页上写一个EditText
. 然后,您只需从WebView
复制选定的文本数据并将其粘贴到EditText
.
You have to take one EditText
on your yellow page. Then you simply copy the selected text data from WebView
and paste it on the EditText
.
或者,如果您不希望EditText
用于Android - Clipboard
Alternatively, if you don't want an EditText
go for Android - Clipboard
这篇关于隐藏文本选择手柄使焦点不清晰:Android -Webview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!