隐藏文本选择手柄使焦点不清晰:Android -Webview [英] Hide text selection handles on out of focus: Android -Webview

查看:100
本文介绍了隐藏文本选择手柄使焦点不清晰:Android -Webview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当用户在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

示例1

示例2

Android剪贴板

这篇关于隐藏文本选择手柄使焦点不清晰:Android -Webview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆