changing ActionBar's height in orientation mode

旧城冷巷雨未停 提交于 2019-12-30 12:04:11

问题


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

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

in orientation mode, its height was not changed.


回答1:


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

values/dimens.xml:

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

values-land/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> 


来源:https://stackoverflow.com/questions/17690005/changing-actionbars-height-in-orientation-mode

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!