Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
245 views
in Technique[技术] by (71.8m points)

xml - Hide text selection handles on out of focus: Android -Webview

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>

enter image description here

enter image description here

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.

Alternatively, if you don't want an EditText go for Android - Clipboard

example 1

example 2

Android Clipboard


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...