res/drawable/actionbar_bg.xml
- <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
- android:src="@drawable/bg2"
- android:tileMode="repeat" />
res/values/styles.xml
- <resources>
- <style name="MyTheme" parent="@android:style/Theme.Holo.Light">
- <item name="android:windowBackground">@drawable/bg</item>
- <item name="android:actionBarStyle">@style/MyActionBar</item>
- </style>
- <style name="MyActionBar" parent="@android:style/Widget.Holo.Light.ActionBar">
- <item name="android:titleTextStyle">@style/MyActionBarTitle</item>
- <item name="android:subtitleTextStyle">@style/MyActionBarSubTitle</item>
- <item name="android:background">@drawable/actionbar_bg</item>
- </style>
- <style name="MyActionBarTitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Title">
- <item name="android:textColor">#fff</item>
- </style>
- <style name="MyActionBarSubTitle" parent="@android:style/TextAppearance.Holo.Widget.ActionBar.Subtitle">
- <item name="android:textColor">#fff</item>
- </style>
- </resources>
としたら、リピートされなくて引き伸ばしたようになってしましました。
調べたら、
[Honeycomb / Android 3.0] ActionBar background image - Stack Overflow -
に書いてありました。
honeycomb / Android 3.0 の既知のバグだそうです。3.1 では直ってるのかな?
現状での解決方法はコードから指定する。です。
Activity の onCreate() で
- final ActionBar actionBar = getActionBar();
- BitmapDrawable background = (BitmapDrawable)getResources().getDrawable(R.drawable.bg2);
- background.setTileModeXY(android.graphics.Shader.TileMode.REPEAT, android.graphics.Shader.TileMode.REPEAT);
- actionBar.setBackgroundDrawable(background);
のように指定するとちゃんとリピートされます。
0 件のコメント:
コメントを投稿