Android tileMode="repeat" and scaling

Issue

I have a simple problem.

This is my XML

<LinearLayout
    android:id="@+id/tab_layout"
    android:layout_width="match_parent"
    android:layout_height="45px" <!-- for testing only -->
    android:orientation="horizontal" >

<ImageView
    android:id="@+id/bed_bugs"
    android:layout_width="0dip"
    android:layout_height="fill_parent"
    android:layout_weight="1"
    android:adjustViewBounds="true"
    android:background="@drawable/button_tab"
    android:src="@drawable/some_title" />

</LinearLayout>

And this is my Drawable button_tab

<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
    <item>
        <bitmap
             android:tileMode="repeat"
             android:src="@drawable/tile_test"/>
    </item>
</layer-list>

tile_test is a simple image image of tile_test

My question is, how can I scale the tiled image?

This is what I have – current

This is what I need – requirement

Solution

i think its imposable in xml, i created what i need in code
1) get bitmap
2) resize bitmap
3) create drawable with tileMode ( from resized pic ofc )
4) set background to you image with created drawable

its simple but not in xml (

Answered By – Дима Савичев

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published