【问题标题】:How can I set the item icon in the navigation drawer to the right side of the item?如何将导航抽屉中的项目图标设置到项目的右侧?
【发布时间】:2017-05-05 05:29:55
【问题描述】:

我希望左侧图标保持原样,我只想在项目右侧再添加一个图标。
请查看下图,它将帮助您了解我的要求。

【问题讨论】:

  • 你有没有尝试过?
  • 是的,先生,但这会将导航抽屉图标带到工具栏的右侧。我不想要那个。我想把物品图标移到右边。
  • 对抽屉使用自定义布局设计。
  • 谢谢你,但如果你能提供我的解决方案,我将不胜感激
  • 嗨,Harshit Paliwal,您不能使用默认菜单,您需要删除默认菜单,并且需要放置视图或类似列表视图类型的东西。

标签: android navigation icons toggle drawer


【解决方案1】:

如果您使用的是抽屉布局或导航抽屉,那么它会对您有所帮助。

只需将导航菜单布局替换为以下线性布局,并需要从活动中删除所有与菜单相关的代码,

<LinearLayout
        android:layout_width="220dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/white"
        android:orientation="vertical">
        <LinearLayout
            android:layout_width="match_parent"
            android:orientation="horizontal"
            android:layout_height="wrap_content">
            <ImageView
                android:layout_width="wrap_content"
                android:src="@drawable/places_ic_search"
                android:layout_height="wrap_content" />
            <ImageView
                android:layout_width="wrap_content"
                android:src="@drawable/places_ic_search"
                android:layout_height="wrap_content" />
            <TextView
                android:layout_width="wrap_content"
                android:text="Hello"
                android:layout_height="wrap_content" />
        </LinearLayout>
    </LinearLayout>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2014-01-07
    • 1970-01-01
    • 2017-03-19
    • 2014-09-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多