changing ActionBar's height in orientation mode

前端 未结 1 1307
感情败类
感情败类 2021-01-15 21:22

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

相关标签:
1条回答
  • 2021-01-15 22:12

    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> 
    
    0 讨论(0)
提交回复
热议问题