【问题标题】:How to create a toolbar with a real button inside?如何创建一个里面有一个真正的按钮的工具栏?
【发布时间】:2020-06-11 23:17:56
【问题描述】:

我想在 Google 日历应用中创建一个带有按钮的工具栏: 我希望我的工具栏左侧有 x,右侧有 Save 按钮。

我不需要/不想要任何标题或 V 形符号(如果是 Google 日历,它只是来自 BottomSheet)

【问题讨论】:

    标签: android material-design android-toolbar


    【解决方案1】:
    You can add button in the toolbar as  follows:
    
        <androidx.appcompat.widget.Toolbar
        android:layout_width="match_parent"
        android:layout_height="?actionBarSize"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:navigationIcon="@drawable/ic_close_black_24dp">
    
        <Button
            android:layout_margin="5dp"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Save"
            android:layout_gravity="end" />
    </androidx.appcompat.widget.Toolbar>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-24
      • 2021-10-01
      • 1970-01-01
      相关资源
      最近更新 更多