【发布时间】:2020-06-11 23:17:56
【问题描述】:
我想在 Google 日历应用中创建一个带有按钮的工具栏: 我希望我的工具栏左侧有 x,右侧有 Save 按钮。
我不需要/不想要任何标题或 V 形符号(如果是 Google 日历,它只是来自 BottomSheet)
【问题讨论】:
标签: android material-design android-toolbar
我想在 Google 日历应用中创建一个带有按钮的工具栏: 我希望我的工具栏左侧有 x,右侧有 Save 按钮。
我不需要/不想要任何标题或 V 形符号(如果是 Google 日历,它只是来自 BottomSheet)
【问题讨论】:
标签: android material-design android-toolbar
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>
【讨论】: