【发布时间】:2020-05-04 09:51:30
【问题描述】:
Android 编程新手,目前正在苦苦挣扎。我正在使用 android studio 的默认“导航抽屉活动”。最重要的是,我从https://github.com/roughike/BottomBar 添加了一个底部栏。但是,在添加了我的 FAB 隐藏在底部栏之后。
这里是 Scrrenshot -
我知道这是某种风格问题。我试图为 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>
需要一些指导来解决这个问题。
【问题讨论】:
-
将此行添加到 Xml android:layout_above="@+id/bottomBar" 中的 android.support.design.widget.FloatingActionButton
-
在下面查看我的答案,如果您遇到任何问题,请告诉我。
-
@Nithinlal LOLZ 你试过给这个
add this line to the android.support.design.widget.FloatingActionButton in Xml android:layout_above="@+id/bottomBar"试试上面的布局。是不是持有这个属性!!!!!!!!!. -
正确答案可以在这里找到:stackoverflow.com/a/43132366/8781554