【问题标题】:Android navigation drawer: Dock item or group to bottomAndroid 导航抽屉:将项目或组停靠到底部
【发布时间】:2015-10-02 11:18:04
【问题描述】:

我想知道如何像在 Google Inbox 应用中一样将项目或组停靠到导航抽屉的底部:

在我的 NavDrawer xml 中找不到该选项:

<item android:title="Generalt">
    <menu>
        <item
            android:id="@+id/nav_send"
            android:icon="@android:drawable/ic_lock_power_off"
            android:title="Log af" />
    </menu>
</item>

【问题讨论】:

    标签: android navigation-drawer


    【解决方案1】:

    在你的导航抽屉fragment,你需要放一个scrollview,在里面你必须放LinearLayout,这将有你的滚动视图,在滚动视图之外你必须用@987654325制作另一个LinearLayout @,因为它在滚动视图之外,它不会滚动并保持在底部:)

    【讨论】:

      【解决方案2】:

      正如#deep513 所说,您必须修改导航抽屉片段。这是一个示例,在这种情况下,我使用了列表视图而不是滚动视图,但这取决于您的需要。

          <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
                  android:layout_height="match_parent"
                  android:orientation="vertical"
                  tools:context=".NavigationDrawerFragment">
      
      
          <ListView
                 android:layout_height="0dp"
                 android:layout_weight="1"
                 android:layout_width="match_parent"
                 android:divider="@android:color/transparent"
                 android:dividerHeight="0dp"
                 android:background="#cccc"
                 android:choiceMode="singleChoice"/>
      
          <LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">
              <TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="Help"/>
              <TextView
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:text="Settings"/>
          </LinearLayout>
      
      </LinearLayout>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-10-04
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2020-12-08
        相关资源
        最近更新 更多