Aug*_*nta 0 android android-layout
我正在尝试在底部导航菜单顶部创建一个带有 FAB 的布局,但菜单始终位于按钮上方。:(
我的layout.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:id="@+id/container"
tools:context="com.example.mytest.money.MainActivity">
<android.support.v7.widget.CardView
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/card_view"
android:layout_width="match_parent"
android:layout_margin="10dp"
android:layout_height="110dp"
android:padding="15dp"
card_view:cardElevation="2dp"
card_view:cardCornerRadius="4dp">
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="Test" />
</android.support.v7.widget.CardView>
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/bottom_navigation"
android:layout_alignParentTop="true"
android:foreground="@color/colorBackground">
</ScrollView>
<com.aurelhubert.ahbottomnavigation.AHBottomNavigation
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:selectedBackgroundVisible="false"
android:layout_gravity="bottom" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/create_gain_expense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_margin="15dp"
android:layout_above="@id/bottom_navigation"
android:src="@drawable/ic_add_white_24dp"
app:fabSize="normal" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)
我的期望:
我得到了什么:
我能做些什么来改变这种情况?:D
我想这个问题是,AHBottomNavigation具有较高的elevation比FloatingActionButton这就是为什么上面的表现FloatingActionButton。
FloatingActionButton具有默认6dp高度和默认elevation的AHBottomNavigationIS 8dp(来自AHBottomNavigation 源)
尝试将更高设置elevation为FloatingActionButton:
<android.support.design.widget.FloatingActionButton
android:id="@+id/create_gain_expense"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|center"
android:layout_margin="15dp"
android:layout_above="@id/bottom_navigation"
android:src="@drawable/ic_add_white_24dp"
app:fabSize="normal"
app:elevation="12dp"
app:borderWidth="0dp" />
Run Code Online (Sandbox Code Playgroud)
#. 您也可以使用android.support.design.widget.BottomNavigationView代替AHBottomNavigation。
下面是应用程序结构的正交视图:
请参阅文档。
希望这会有所帮助~
| 归档时间: |
|
| 查看次数: |
1406 次 |
| 最近记录: |