0

How I can change size of menu item icons displayed in options menu inside ActionMenuView in Toolbar?

I have vector drawables like this

<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="512dp"
    android:height="512dp"
    android:viewportWidth="512"
    android:viewportHeight="512">

    <path
        android:fillColor="@android:color/black"
        android:pathData="M487.976 0H24.028C2.71 0-8.047 25.866 7.058 40.971L192 225.941V432c0 7.831 3.821 15.17 10.237 19.662l80 55.98C298.02 518.69 320 507.493 320 487.98V225.941l184.947-184.97C520.021 25.896 509.338 0 487.976 0z" />
</vector>

So it should scale but it does not.

action menu view is

<androidx.appcompat.widget.ActionMenuView
                android:id="@+id/toolbarTrailingActionMenu"
                android:layout_width="wrap_content"
                android:layout_height="?attr/actionBarSize"
                android:elevation="4dp"
                android:layout_marginEnd="0dp"
                android:translationX="16dp"

                android:theme="@style/AppTheme.ToolbarMenuOverflow"

                app:layout_constraintEnd_toEndOf="parent"
                app:layout_constraintBottom_toBottomOf="parent"
                app:layout_constraintTop_toTopOf="parent" />
Michał Ziobro
  • 10,759
  • 11
  • 88
  • 143

1 Answers1

0

Better way to get vector size you need - is to set vector size when you get it for project: enter image description here

set size you need in those fields

Alex Rmcf
  • 804
  • 7
  • 14
  • I think it will work changing size this way. I used online tool for conversion SVG to vector and there was no such option like size. But I also consider how to adjust it in code. But it seems to be hard. I found some styles but seems to not work – Michał Ziobro Jun 18 '20 at 11:20