Android float 按钮和高级 webview 不起作用

标签 android xml android-studio webview

我有一个带有 android 高级 web View 的 float 按钮,一切都显示得很好,但是当我单击 float 按钮时,它会在 web View 中注册单击并更改页面。就像我在点击 webview 一样。

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context="net.seekadventure.seekadventure.MainActivity">

    <android.support.design.widget.AppBarLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:theme="@style/AppTheme.AppBarOverlay">

    </android.support.design.widget.AppBarLayout>

    <im.delight.android.webview.AdvancedWebView
        android:id="@+id/newWeb"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        >

    </im.delight.android.webview.AdvancedWebView>

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentBottom="true"
        android:layout_alignParentEnd="true"
        android:layout_gravity="bottom|end"
        android:layout_marginBottom="24dp"
        android:layout_marginEnd="21dp"
        android:src="@drawable/ic_share" />

    <ProgressBar
        style="?android:attr/progressBarStyleLarge"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/loader"
        android:layout_weight="1"
        android:layout_gravity="center_vertical|center_horizontal|center"/>

</android.support.design.widget.CoordinatorLayout>

最佳答案

试试这个让你的 FloatingActionButton

    android:clickable="true"
    android:focusableInTouchMode="true"
    android:focusable="true"

示例代码

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentEnd="true"
    android:layout_gravity="bottom|end"
    android:layout_marginBottom="24dp"
    android:layout_marginEnd="21dp"
    android:clickable="true"
    android:focusableInTouchMode="true"
    android:focusable="true"
    android:src="@drawable/ic_menu_send" />

关于Android float 按钮和高级 webview 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51074935/

相关文章:

java - 如何在 Java 中读取在线 XML 文件以获取货币汇率

android - 为后台任务选择哪一个 - 具有重复任务的计时器或具有循环的服务?

java - 无法使用 maven-android-plugin 将第 3 方 jar 包含到 Android 应用程序中

android - 将列表传递给 Android 中的另一个 Activity

java - 为应用程序生成测试数据

android-studio - flutter 应用栏中不需要的操作按钮

android - 每次运行时更改都会重新创建 MediaBrowserServiceCompat 实例

xml - 为什么内容在删除 scrollFlags `scroll` 后被拖动?

java - 可以使用 JAXB(或 JAXB + StAX)编码 XML 的一部分吗?

android - 如何将 react-native 包导入和修改到各自的原生开发工具中