【发布时间】:2012-05-17 21:15:27
【问题描述】:
我有一个问题我不明白:
我刚刚在我的应用程序上设置了一个 ActionBar(目标 SDK 11,主题 Holo.Light)。但是当我以 XML 或 setBackgroundDrawable(d) 方式设置背景时, 背景没有缩放到 ActionBar 的高度:
-如果drawable太小,它会被拉伸以填充action bar的高度。 - 但如果太高,它不会缩回去,会覆盖在布局的其余部分上。
我刚刚遵循了 android dev 中提供的指南,并尝试通过 DrawableBitmap 进行设置,但结果相同。
非常感谢您的任何回答。
<resources>
<!-- the theme applied to the application or activity -->
<style name="CustomActivityTheme" parent="@android:style/Theme.Holo">
<item name="android:actionBarStyle">@style/MyActionBar</item>
<!-- other activity and action bar styles here -->
</style>
<!-- style for the action bar backgrounds -->
<style name="MyActionBar" parent="@android:style/Widget.Holo.ActionBar">
<item name="android:background">@drawable/ab_background</item>
</style>
【问题讨论】:
标签: android background-image android-actionbar