Скрыть маркеры выделения текста не в фокусе: Android-Webview - PullRequest
0 голосов
/ 08 мая 2019

Я пытаюсь скрыть маркеры выделения текста, когда пользователь щелкает где-то еще (плавающая кнопка) в веб-просмотре, как показано на изображениях, маркеры перекрываются с моим линейным макетом. layout_meaning_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

1 Ответ

0 голосов
/ 08 мая 2019
 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...
 this will sort out your problem...
 otherwise if you dont wants to take EditText, then go for "Android - Clipboard" <https://developer.android.com/guide/topics/text/copy-paste> . 
 example 1: https://www.tutlane.com/tutorial/android/android-clipboard-with-examples
 example 2: https://www.tutorialspoint.com/android/android_clipboard.htm   
...