Android浮动操作按钮隐藏在底部导航栏后面

2024-03-11

Android 编程新手,现在正在苦苦挣扎。我正在使用 android studio 的默认“导航抽屉活动”。最重要的是,我添加了一个底部栏https://github.com/roughike/BottomBar。但是,添加后我的 FAB 已隐藏在底部栏后面。

这是屏幕截图 -

我知道这是某种风格问题。我试图给 FAB 提供bottomMargin。但是,它不起作用。

这是我的代码 -

app_bar_main.xml

<?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="com.bhramaan.android.bhramaan.MainActivity">

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

        <android.support.v7.widget.Toolbar
            android:id="@+id/toolbar"
            android:layout_width="match_parent"
            android:layout_height="?attr/actionBarSize"
            android:background="?attr/colorPrimary"
            app:popupTheme="@style/BhramaanTheme.PopupOverlay" />

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

    <include layout="@layout/content_main" />

    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        android:src="@android:drawable/ic_dialog_email" />

    <com.roughike.bottombar.BottomBar
        android:id="@+id/bottomBar"
        android:layout_width="match_parent"
        android:layout_gravity="bottom|end"
        android:layout_height="60dp"
        android:layout_alignParentBottom="true"
        app:bb_behavior="shy"
        android:background="@color/bottomBar"
        app:bb_activeTabColor="@color/white"
        app:bb_tabXmlResource="@xml/bottombar_tabs" />

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

需要一些指导来解决这个问题。


添加 app:elevation="@dimen/text_margin" 像这样:

<android.support.design.widget.FloatingActionButton
    android:id="@+id/fab"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom|end"
    android:layout_margin="@dimen/fab_margin"
    android:src="@android:drawable/ic_dialog_email"
    app:elevation="@dimen/text_margin" /><!--adding this line should resolve your problem-->
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android浮动操作按钮隐藏在底部导航栏后面 的相关文章

  • 如何在Android 4.2中更改Action Bar选项菜单的背景颜色?

    我想更改 Android 4 2 中选项 溢出 菜单的背景颜色 我已经尝试了所有方法 但它仍然显示主题设置的默认颜色 我使用了以下代码和 XML 配置 MainActivity java public class MainActivity
  • 将JSON数据解析到Android ListView中

    我已经潜伏这个网站很长一段时间了 幸运的是 到目前为止我所有的问题都得到了解答 我希望你们中的一些人能够阐明我的问题 我可以成功地让 ListView 来显示字符串数组 但是当我尝试将 JSON 数据解析为数组时 我的程序只是强制关闭 而
  • 对话框片段嵌入取决于设备

    在我的应用程序中 用户从联系人或通话记录中选择电话号码 选择联系人非常简单 并且在手机和平 板电脑上都可以很好地工作 i e 在手机上会弹出新的全屏活动 在桌子上我会看到带有联系人列表的漂亮弹出对话框 似乎无法从通话记录中选择电话号码 因此
  • 手机重置后AlarmManager闹钟不触发

    在我的应用程序中 用户加入一个计划 然后第二天中午会出现警报通知 这是我的代码 首先 我在 AlarmManager 中设置一个闹钟 如下所示 set alarm to the next day 12 00 noon of the join
  • app-release-unsigned.apk 未签名

    我在 github 上下载了 Android 应用程序的 zip 文件 并尝试运行它 但出现一个包含此消息的对话框 app release unsigned apk is not signed Please configure the si
  • Android SQLite 从代码中转储数据库以进行错误报告

    我正在为我的一个 Android 程序开发一种诊断工具 本质上 如果用户遇到问题 我想做一些类似 SQLite 的事情dump 参考 http www sqlite org sqlite html http www sqlite org s
  • 如何在 Picasso 中使用磁盘缓存?

    我正在使用 Picasso 在我的 Android 应用程序中显示图像 load image This is within a activity so this context is activity public void loadIma
  • android.view.InflateException:二进制 XML 文件行 #11:膨胀类 ImageView 时出错

    我只是尝试制作一个小的 android java xml 应用程序来计算游戏的分数 它给了我这个错误 Error inflateing class ImageView 有人知道解决方案吗 我实际上搜索了 ppl 说添加这个 android
  • Firebase Messaging FCM 在可配置的时间间隔内分发

    当您使用 FCM 向给定应用程序的所有设备发送推送时 这可能会导致许多用户同时打开他们的应用程序 从而导致大量服务器轮询 从而导致负载峰值 有没有一种方便的方法可以在给定的时间间隔内分发消息以进行计划推送 最后 我们找到了一种可能的方法 通
  • 有人可以给出一个 android 中 webview 实现的确切例子吗

    嗨 我正在使用开发 Android 应用程序WebView执行 我跟着官方安卓教程 http developer android com resources tutorials views hello webview html 在 Ecli
  • AltBeacon 服务位于单独的 Android 进程中

    我需要帮助 有一个适用于 Xamarin Android 的应用程序 在其中 启动了一个与 AltBeacon 库配合使用的服务 在此服务中 创建了一个线程 在该线程中不断扫描信标 服务以 StartForeground 启动 该服务应该有
  • 在没有 BluetoothManagerCallback 的情况下调用 getBluetoothService

    我正进入 状态getBluetoothService called with no BluetoothManagerCallback在我的 Android 应用程序中经常出现错误 我不知道是什么原因导致这个或任何有关蓝牙管理器回调的事情 谁
  • 垂直从上到下线手势检测器

    我用的是 手势工具 注意到对于垂直从上到下的线无法检测 因为我在代码中使用生成的手势文件 如下所示 但无法检测垂直从上到下的线手势检测 import java util ArrayList import android app Activi
  • 运行 Android 应用程序时出现错误

    我已经使用 Eclipse 创建了一个 Android 应用程序 但应用程序未在 AVD 上运行 它显示 不幸的是已停止工作 日志猫消息如下 07 29 04 59 50 789 W dalvikvm 784 threadid 1 thre
  • Android 10 请求 ACTIVITY_RECOGNITION 权限

    我试图遵守 Google 的要求 为 Android 10 请求 ACTIVITY RECOGNITION 权限 但我似乎不明白为什么没有显示权限弹出窗口 就像其他权限 即位置 存储等 一样 我的代码是 if ContextCompat c
  • 如何获取小区广播消息?

    我尝试像模拟人生一样获取小区广播消息的文本 但它不起作用 public class SMSReceiver extends BroadcastReceiver Override public void onReceive Context c
  • 如何检测日期选择器对话框的取消单击?

    我正在使用以下 日期选择器的示例 http developer android com guide tutorials views hello datepicker html http developer android com guide
  • Android Studio 中自动打开“运行设备”选项卡

    在 Android Studio Flamingo 中有一个名为跑步设备并且它会在每次之后自动打开运行应用程序 有办法禁止这个自动打开吗 我尝试禁用启用物理 Android 设备的镜像选项 但选项卡仍然自动打开 基于此issue https
  • 如何减少 Android 中浮动 editText 提示和 editText 框之间的空间?

    我有一个带有浮动提示的 EditText 但我想知道如何减少浮动提示和 EditText 框之间的空间 现在我的用户界面看起来像https i stack imgur com ltfra jpg https i stack imgur co
  • 在 Qt 中构建 Android 项目不再有效

    所以我对 Android SDK NDK 和 Apache Ant 进行了一些更新 现在我无法构建任何 Android 项目 我收到一条警告 然后它说找不到 build xml 文件 错误 Warning Android platform

随机推荐