使工具栏和菜单按钮的高度更小

Make toolbar and menu button have smaller height

我有一个工具栏(请参阅下面的 xml)。有什么简单的方法可以让工具栏变细,同时保留菜单按钮吗

或者只是在某个角落有一个菜单按钮?

一开始是全屏 activity,但我卷起自己的视图并执行以下操作:setContentView(view);

谢谢

  <activity
            android:name=".FullscreenActivity"
            android:configChanges="orientation|keyboardHidden|screenSize"
            android:label="@string/app_name"
            android:theme="@style/FullscreenTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>


<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="FullscreenTheme" parent="AppTheme">
        <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
        <item name="android:windowActionBarOverlay">true</item>
        <item name="android:windowBackground">@null</item>
        <item name="metaButtonBarStyle">?android:attr/buttonBarStyle</item>
        <item name="metaButtonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
    </style>

    <style name="FullscreenActionBarStyle" parent="Widget.AppCompat.ActionBar">
        <item name="android:background">@color/black_overlay</item>
    </style>

</resources>

指定此样式:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
    ...
    <item name="actionBarSize">20dp</item>
    <item name="actionBarStyle">@style/MyActionBarStyle</item>
</style>

<style name="MyActionBarStyle" parent="Widget.AppCompat.Light.ActionBar.Solid">
    <item name="actionButtonStyle">@style/MyActionButtonStyle</item>
    <item name="displayOptions">homeAsUp</item>
</style>

<style name="MyActionButtonStyle" parent="Widget.AppCompat.Light.ActionButton">
    <item name="android:minWidth">20dp</item>
    <item name="android:minHeight">20dp</item>
</style>

将导致此输出: