,我把背景圖像behing的動作條,看起來如下:規模操作欄背景圖片按比例
在我手機實際上看起來不錯,但在其他手機上,它看起來非常壓扁。我如何根據背景的比例按比例調整ActionBar?有沒有解決方案?我必須確定修復DPI中的高度,因爲如果我放棄它,ActionBar甚至不會顯示出來。我現在的風格代碼如下:
<style name="MyActionBar" parent="android:Theme.Holo.Light">
<item name="android:backgroundStacked">@drawable/tab_bg</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:scaleType">fitEnd</item>
<item name="android:height">87dp</item>
</style>
更新:
我只是不知道哪裏來Mr.T的XML代碼。我使用基本的Android ActionBar,並且我只有一個名爲menu.xml的xml,但是如果我把代碼放入它,沒有任何效果。
我嘗試使用以下方式設置操作欄的風格,但如果不指定android:height參數,操作欄仍然爲0並且不顯示。
<style name="MyActionBar" parent="android:Theme.Light">
<item name="android:backgroundStacked">@drawable/tab_bg</item>
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:src">@drawable/tab_bg</item>
<item name="android:scaleType">matrix</item>
</style>
該操作欄在某些設備上仍然類似於以下內容; http://i.imgur.com/yQN67J3.png
我已經更新了這個問題。 –