Android 在导航抽屉中添加页脚布局

Android 在导航抽屉中添加页脚布局,android,xml,user-interface,Android,Xml,User Interface,注销布局与导航抽屉中5.5英寸屏幕设备下方的菜单项重叠 这在5.5英寸屏幕设备中看起来非常完美 这是我的xml代码。我的问题是如何让注销布局成为5.5英寸以下屏幕中导航抽屉的一部分,以便用户可以滚动菜单到达底部以获得注销按钮 谢谢。如果您正试图像其他人一样将注销添加到导航列表中的项目,并在向下滚动时查看注销,如果我正确,请尝试使用ListView,而不是单独使用注销,并将注销添加为项目之一。我看不到您的JAVA代码说明如何添加其他项。希望它能解决您的问题。以下是示例代码: ` `有关单击或处理页

注销布局与导航抽屉中5.5英寸屏幕设备下方的菜单项重叠

这在5.5英寸屏幕设备中看起来非常完美

这是我的xml代码。我的问题是如何让注销布局成为5.5英寸以下屏幕中导航抽屉的一部分,以便用户可以滚动菜单到达底部以获得注销按钮


谢谢。

如果您正试图像其他人一样将注销添加到导航列表中的项目,并在向下滚动时查看注销,如果我正确,请尝试使用ListView,而不是单独使用注销,并将注销添加为项目之一。我看不到您的JAVA代码说明如何添加其他项。希望它能解决您的问题。以下是示例代码:

`


`

有关单击或处理页脚:

NavigationView navigationView = (NavigationView) findViewById(R.id.navi);
    ListView footerLV = (ListView) navigationView.findViewById(R.id.expnavimenu);
    footerLV.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Toast.makeText(MainActivity.this, "Footer is clicked", Toast.LENGTH_SHORT).show();
        }
    });
此解决方案适合我:

我希望它能解开这个结

<android.support.design.widget.NavigationView
        android:id="@+id/navi"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:menu="@menu/main_menu"
        android:background="#CCCCCC">
        <ListView
             xmlns:android="http://schemas.android.com/apk/res/android"
             xmlns:tools="http://schemas.android.com/tools"
             android:id="@+id/expnavimenu"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:choiceMode="singleChoice"
             android:dividerHeight="2dp"
             android:groupIndicator="@color/white"
             android:listSelector="@color/greyc4"
             android:childIndicator="@color/greyc4"
             android:background="@color/white"
             android:layout_marginTop="5dp"
             android:layout_marginBottom="5dp"/>
 </android.support.design.widget.NavigationView>
NavigationView navigationView = (NavigationView) findViewById(R.id.navi);
    ListView footerLV = (ListView) navigationView.findViewById(R.id.expnavimenu);
    footerLV.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Toast.makeText(MainActivity.this, "Footer is clicked", Toast.LENGTH_SHORT).show();
        }
    });
<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>