[英]how to make android menu icon and menu items larger
I made a menu.xml like this: 我做了一个menu.xml像这样:
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/about_credits"
android:orderInCategory="100"
app:showAsAction="never"
android:title="About-Credits"/>
</menu>
and I added that in my toolbar, like this: 然后将其添加到工具栏中,如下所示:
@Override
public boolean onCreateOptionsMenu(Menu menu) {
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.main, menu);
return true;
}
and this is how it looks: 这是它的外观:
How do I make the menu icon and menu items a little bit larger and also vertically centered in the toolbar? 如何使菜单图标和菜单项稍大一些,并使其在工具栏中垂直居中?
You can set icon by adding this line of code 您可以通过添加以下代码行来设置图标
<item
android:id="@+id/about_credits"
android:orderInCategory="100"
app:showAsAction="never"
android:title="About-Credits"
android:icon="drawable/icon name/>
<menu xmlns:android="http://schemas.android.com/apk/res/android" >
<item
android:id="@+id/about_credits"
android:title="About-Credits"
android:showAsAction="always"
android:orderInCategory="100"
android:actionLayout="@layout/custom_menu_item" />
</menu>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.