我想改变动作条图标大小我想、图标、大小、动作

2023-09-05 11:21:38 作者:沉沦∫空白的心

我试图用这个code

I tried to use this code

<item
        android:id="@+id/male_button"
        android:layout_width="46dp"
        android:layout_height="56dp"
        android:layout_gravity="right"
        android:icon="@drawable/icon_male"
        android:showAsAction="always"
        android:title="i"/>
    <item
        android:id="@+id/female_button"
        android:layout_width="46dp"
        android:layout_height="56dp"
        android:layout_gravity="right"
        android:icon="@drawable/icon_female"
        android:showAsAction="always"
        android:title="i"/>

和我改变了机器人:layout_width =46dp到Android:layout_width =30dp 但我仍然有相同的大小 所需的图像是

and I changed android:layout_width="46dp" to android:layout_width="30dp" but I still have the same size the desired image is

和我现在有这个

我如何更改图标是一样的第一张照片?

How can I change the icons to be as the first picture ?

推荐答案

看这回答。你必须设置动作条尺寸在应用程序或活动的主题。然后,你应该能够图标的高度设置为match_parent

Look at this answer. You have to set the ActionBar size in the app or activity's theme. Then, you should be able to set the height of the icons to "match_parent".