【问题标题】:How to change the height of action bar in android 4.2.2如何在 android 4.2.2 中更改操作栏的高度
【发布时间】:2013-09-07 06:33:51
【问题描述】:

是否可以更改操作栏的高度?我尝试过使用 ActionBar.setCustomView(view, layoutparams) 但无法更改高度。 请提出建议。任何帮助将不胜感激。

【问题讨论】:

标签: android android-actionbar


【解决方案1】:

要设置 ActionBar 的高度,您可以在 res/values 文件夹中创建一个新文件 themes.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>   
    <style name="Theme.FixedSize" parent="@android:style/Theme.Holo.Light.DarkActionBar">
        <item name="actionBarSize">48dip</item>
        <item name="android:actionBarSize">48dip</item> 
    </style> 
 </resources>

并将此主题设置为您的活动:

android:theme="@style/Theme.FixedSize"

【讨论】:

    【解决方案2】:

    或者直接在styles.xml里面添加下面一行:

        <item name="android:actionBarSize">35dp</item>
    

    <!-- 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>
        <item name="android:textAllCaps">false</item>
        <item name="android:actionBarSize">35dp</item>
    </style>
    

    【讨论】:

      【解决方案3】:

      您只需要添加 项目名称="actionBarSize" 60dp 项目 在styles.xml中。

      【讨论】:

        猜你喜欢
        • 2013-02-12
        • 2022-01-24
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多