Android 在工具栏选项菜单上显示图像视图而不是图标
当您覆盖Android 在工具栏选项菜单上显示图像视图而不是图标,android,kotlin,optionmenu,Android,Kotlin,Optionmenu,当您覆盖onCreateOptions菜单()时,您会看到一个选项菜单,当您单击右上角的3点图标时,该菜单将打开。我想用一个用户的图像而不是3点图标显示一个圆形图像视图。我该怎么做 override fun onCreateOptionsMenu(menu: Menu?): Boolean { menuInflater.inflate(R.menu.options_menu, menu); return true } 您好@Amol您可以从以下网站了解有关工具栏的更多信息: 尝
onCreateOptions菜单()
时,您会看到一个选项菜单,当您单击右上角的3点图标时,该菜单将打开。我想用一个用户的图像而不是3点图标显示一个圆形图像视图。我该怎么做
override fun onCreateOptionsMenu(menu: Menu?): Boolean {
menuInflater.inflate(R.menu.options_menu, menu);
return true
}
您好@Amol您可以从以下网站了解有关工具栏的更多信息: 尝试替换工具栏
<androidx.appcompat.widget.Toolbar
android:layout_width="match_parent"
android:layout_height="wrap_content">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.appcompat.widget.AppCompatImageView
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:layout_gravity="end"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@mipmap/ic_launcher_round" />
</FrameLayout>
</androidx.appcompat.widget.Toolbar>
这是否回答了您的问题?此链接可能有帮助: