How to customize your theme background image in Android action

I spent a lot of time on this, and of all the "answers" that I saw in the search, no one works. Basically, I just want the bitmap to be centered horizontally in the subject, and then repeated vertically. No matter what I do, it always aligns to the left. I tried it in code and in XML. Here is what I'm using right now:

AndroidManifest.xml

<activity android:name=".MyActivity" android:label="MyActivity"
        android:theme="@style/ThemeName" />

RES / value / styles.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="ThemeName" parent="android:Theme">
        <item name="android:windowBackground">@drawable/xml_bitmap</item>
    </style>
</resources>

Res / extract / xml_bitmap.xml

<?xml version="1.0" encoding="UTF-8"?>
<bitmap
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/png_image"
    android:tileMode="repeat"
    android:gravity="center_horizontal"
/>

To help clarify, I also tried setting the background to a bitmap in the code as follows:

Resources r = getResources();
Drawable d = r.getDrawable(R.drawable.xml_bitmap);
getListView().setBackgroundDrawable(d);

; , - xml_bitmap.xml. , , , SEEM:

+5

All Articles