改变ActionBar的高度方向模式 [英] changing ActionBar's height in orientation mode

查看:139
本文介绍了改变ActionBar的高度方向模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在用动作条(Android原生),几天(软糖4.2)。 我试图在style.xml加入这样一行来改变动作条的高度:

I have been using actionbar(android native) for a few days(jellybean 4.2). I tried to change the actionbar's height by adding such line in style.xml:

100dip

它工作正常在landscapemode,但不定向模式下工作。

it works fine in landscapemode, but do not work in orientation mode.

在取向模式,其高度不改变。

in orientation mode, its height was not changed.

推荐答案

您只需要创建尺寸的高度动作条在纵向和横向模式:

You just have to create dimensions for the height of the ActionBar in portrait and landscape mode:

值/ dimens.xml

<resources>
     <!-- dimension for the portrait ActionBar -->
     <dimen name="ab_height">100dp</dimen>
</resources>

值陆/ dimens.xml

<resources>
     <!-- dimension for the landscape ActionBar -->
     <dimen name="ab_height">120dp</dimen>
</resources>

现在,您可以使用这些尺寸是这样的:

Now you can use these dimensions like this:

<style [...]>
     <item name="android:actionBarSize">@dimen/ab_height</item>
</style> 

这篇关于改变ActionBar的高度方向模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆