gpt4 book ai didi

android - 如何更改 Actionbar 背景的显示方式?

转载 作者:太空狗 更新时间:2023-10-29 16:21:09 25 4
gpt4 key购买 nike

我正在使用 ActionBar Sherlock,我想更改 ActionBar 背景。我能够通过修改我的样式 XML 文件来实现这一点:

<item name="android:background">@drawable/background_bitmap</item>

问题是无论设备或位置(横向/水平),操作栏背景图形总是拉伸(stretch),如下所示:

人像模式:

portrait mode

横向模式:

landscape mode

有没有办法改变 background_bitmap 的显示方式?

我宁愿背景要么左/右对齐,要么缩放和裁剪。

最佳答案

是的,在 /res/drawable/ 中创建一个像这样的 drawable xml,并将其引用为 action bar background drawable。

<?xml version="1.0" encoding="utf-8"?>
<bitmap xmlns:android="http://schemas.android.com/apk/res/android"
android:gravity="right"
android:src="@drawable/background_bitmap" />

关于android - 如何更改 Actionbar 背景的显示方式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14523109/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com