InflexCZE
InflexCZE

Reputation: 732

Is possible to set dynamic source of bitmap to android XML drawable

XML code

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- another items -->
    <item>
       <Bitmap android:src="@drawable/drawable_by_argument"/>
    </item>
</layer-list>

In code above i want to set Bitmap android:src attribute dynamicaly by some argument. Something like:

Java code

getResources().getDrawable(R.drawable.back, R.drawable.some_img);

Is it possible. If yes how can i do it.

Thanks for help.

Upvotes: 0

Views: 450

Answers (1)

Budius
Budius

Reputation: 39856

no. it's not possible.

XML is not dynamic, it's static and heavy parsed during compiling time.

Upvotes: 1

Related Questions