所以我不知道如何在RecyclerView下的LinearLayout中对齐底部导航。这些是RecyclerView:
<!DOCTYPE html>
<html lang="pt-BR">
<head>
<title>Finances | Manage your money easily</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Control you spending and manage your money easily. Your finances by the short hairs.">
<meta name="author" content="Bruno M. B. Sdoukos">
<meta name="keywords" content="finances, managing money, spending control">
<link rel="stylesheet" type="text/css" href="index_default.css">
<link rel="stylesheet" type="text/css" media="screen and (max-width: 600px)" href="index_small.css">
<link rel="stylesheet" type="text/css" media="screen and (min-width: 1500px)" href="index_large.css">
</head>
<body>
<header>
<a href="index.html"><img src="Images/icons8-fund-accounting-80.png"></a>
<a href="index.html"><h1>Finances</h1></a>
<nav>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="#">About</a></li>
<li><a href="#">Contact us</a></li>
<li><a href="#">Register</a></li>
<li><a href="#">Login</a></li>
</ul>
<a href="#"><img src="Images/icons8-menu-50.png" id="menu"></a>
</nav>
</header>
<main>
<section id="firstsection">
<div>
<h1>Manage your money easily, anywhere, anytime.</h1>
<a href="#">Get started</a>
</div>
</section>
<section id="middlesection">
<div id="textboxes">
<div>
<img src="Images/icons8-increase-64.png">
<h3>Concrete data</h3>
<p>Simple but concrete data that are the answer to all the quesions about your current money, spending and.</p>
</div>
<div>
<img src="Images/icons8-navigation-toolbar-left-filled-50 (1).png">
<h3>Easy interface</h3>
<p>An interface easy to use, made to you who want to manage your money faster and with no problems.</p>
</div>
<div>
<img src="Images/icons8-natural-user-interface-2-filled-50.png">
<h3>Fast access</h3>
<p>No complications that make you lose time. Just some clicks and done, you are in Finances, with all you need.</p>
</div>
</div>
</section>
<section id="lastsection">
<img src="Images/board-1362851_1280.png">
<div>
<h2>Register now and enjoy<br>the best of Finances.</h2>
<a href="#">Create an account</a>
</div>
</section>
</main>
<footer>
<img src="Images/icons8-fund-accounting-80.png">
<div>
<p>A work of Bruno Sdoukos.</p>
</div>
</footer>
</body>
</html>
导航应始终在底部。
答案 0 :(得分:2)
好的,这是您的布局,它应该可以按预期工作
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.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/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_category"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/nav_view"
android:layout_below="@+id/appbar"
android:layout_margin="8dp"
android:orientation="vertical" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?android:attr/windowBackground"
app:menu="@menu/menu_navigation" />
</RelativeLayout>
答案 1 :(得分:0)
不确定,但尝试添加以下内容:
android:layout_gravity =“ bottom”
答案 2 :(得分:0)
如果您不想更改为RelativeLayout
,请将此属性设置为RecyclerView
:
android:layout_weight="1"
这样,RecyclerView
将占用所有可用空间,将BottomNavigationView
推到底部。
答案 3 :(得分:0)
您无法在BottomNavigationView
内正确调整LinearLayout
。如果您的RecyclerView
中有太多项目,那么BottomNavigationView
将被隐藏在底部。因此,您必须使用RelativeLayout
使其在BottomNavigationView
的底部和上方的其他布局中对齐。请检查波纹管修改后的布局。
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:theme="@style/AppTheme.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/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/recycler_category"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@+id/nav_view"
android:layout_below="@+id/appbar"
android:layout_margin="8dp"
android:orientation="vertical" />
<android.support.design.widget.BottomNavigationView
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="?android:attr/windowBackground"
app:menu="@menu/menu_navigation" />
</RelativeLayout>