我需要在导航抽屉的底部设置带有背景图像的textview。我无法从xml中完成。
答案 0 :(得分:1)
尝试以下代码: -
<submit>
nav_bar_playback_controls.xml
<android.support.design.widget.NavigationView
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="start"
android:background="@color/side_menu_bg_color"
android:fitsSystemWindows="false"
android:scrollbars="none"
android:theme="@style/NavigationDrawerStyle"
app:headerLayout="@layout/nav_header_mains"
app:itemTextAppearance="@style/NavigationDrawer"
app:itemTextColor="@color/White"
app:menu="@menu/activity_main_drawer"
app:selectableItemBackground="@drawable/nav_drawer_item_selector">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:clickable="true"
android:orientation="vertical">
<include layout="@layout/nav_bar_playback_controls" /> // This is bottom layout with black background and 2 textviews
</LinearLayout>
</android.support.design.widget.NavigationView>
答案 1 :(得分:0)
在您的activity_main.xml中,
<?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" />
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true">
<android.support.design.widget.NavigationView
android:layout_above="@+id/llBottomLay"
android:id="@+id/nav_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<LinearLayout
android:id="@+id/llBottomLay"
android:layout_alignParentBottom="true"
android:layout_width="match_parent"
android:layout_height="55dp"
android:background="#e6e6e6"
android:orientation="horizontal">
<!--place your things here-->
</LinearLayout>
</RelativeLayout>
</android.support.v4.widget.DrawerLayout>
* id llBottomLay 的LinearLayout需要根据您的需要替换为Relative或其他选项
答案 2 :(得分:0)
尝试这样的事情:
<?xml version="1.0" encoding="utf-8"?>
<merge>
<android.support.v4.widget.DrawerLayout>
...removed for brevity...
</android.support.v4.widget.DrawerLayout>
<TextView
...your required properties...
android:gravity="bottom" android:layout_gravity="bottom"/>
</merge>