问题描述
android编程&的新手现在正在挣扎.我正在使用android studio的默认导航抽屉活动".最重要的是,我从https://github.com/roughike/BottomBar
添加了一个底部栏.但是,在补充说我的FAB隐藏在底部栏后面之后.
New to android programming & struggling with right now. I'm using android studio's default "Navigation Drawer Activity". On top of that, I've added a Bottom Bar from https://github.com/roughike/BottomBar
. But, after adding that my FAB has hidden behind the Bottom Bar.
这是Scrrenshot-
Here is the Scrrenshot -
我知道这是某种风格问题.我试图为FAB提供bottomMargin.但是,它不起作用.
I know it's some kind of style issue. I tried to give bottomMargin for FAB. But, it's not working.
这是我的代码-
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>
需要一些指导来解决这个问题.
Need Some Guidance to solve this.
推荐答案
以此更改您的xml
.在Floating Action Button
中添加更多属性.
Change your xml
as this. Add some more properties to your Floating Action Button
.
<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_alignParentRight="true"
android:layout_gravity="bottom|end"
android:layout_marginBottom="70dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="10dp"
android:src="@android:drawable/ic_dialog_email" />
这篇关于隐藏在底部导航栏后面的Android浮动操作按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!