简体   繁体   中英

how to make android menu icon and menu items larger

I made a menu.xml like this:

<?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>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM