在导航抽屉中添加页脚布局 [英] Add footer layout in navigation drawer
本文介绍了在导航抽屉中添加页脚布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
注销"布局与5.5英寸屏幕设备下方的导航抽屉中的菜单项重叠
The Logout layout overlap on the menu items in navigation drawer below 5.5 inch screen devices
这在5.5英寸屏幕设备中看起来很完美
This looks perfect in 5.5 inch screen devices
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout 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:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
tools:openDrawer="start">
<include
layout="@layout/app_bar_main"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@drawable/drawer_bg"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_main"
app:itemTextColor="@color/grey_text"
app:menu="@menu/activity_main_drawer">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="#50000000"
android:clickable="true"
android:orientation="vertical">
<TextView
android:id="@+id/nav_logout"
android:layout_width="match_parent"
android:layout_height="44dp"
android:gravity="center"
android:text="Logout"
android:textColor="@color/colorAccent"
android:textSize="16sp" />
</LinearLayout>
</android.support.design.widget.NavigationView>
</android.support.v4.widget.DrawerLayout>
这是我的xml代码.我的问题是如何让注销布局成为5.5英寸以下屏幕中导航抽屉的一部分,以便用户可以滚动菜单以到达底部以获取注销按钮.
This is my xml codes. My question is how to let the logout layout become a part of navigation drawer in screen below 5.5 inch so that the user can scroll through the menu to reach to bottom to get the logout button.
谢谢.
推荐答案
此解决方案适用于我:
<com.google.android.material.navigation.NavigationView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start">
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.google.android.material.navigation.NavigationView
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:overScrollMode="never"
app:elevation="0dp"
app:headerLayout="@layout/nav_header_main"
app:itemIconTint="?attr/colorArrowDown"
app:menu="@menu/navigation_drawer_menu" />
<LinearLayout
android:id="@+id/spacer_to_bottom"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@drawable/background_white"
android:orientation="vertical"
android:padding="16dp">
<ImageView
android:layout_width="match_parent"
android:layout_height="32dp"
android:src="@drawable/ic_telegram" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="@string/titleChanelTelegram"
android:textSize="@dimen/textSizeTiny" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:text="@string/telegramID"
android:textColor="@color/colorBlack"
android:textSize="@dimen/textSizeNormal" />
<TextView
android:id="@+id/txt_version"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:gravity="center"
android:textSize="10dp" />
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</com.google.android.material.navigation.NavigationView>
我希望它能解开结
这篇关于在导航抽屉中添加页脚布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文