android - Putting drawables in front of one another causes dramatic used memory increase -


usual memory footprint of app around 20mb. however, when put drawables 1 in front of other (for sake of animating each individual element)...

enter image description here

there 2 drawables in picture: green base , pin (with shadow)

...my memory usage goes ~40mb!the layout using xhdpi drawables, have around 2.1mb in total. layout of these drawables is:

<relativelayout         android:layout_width="match_parent"         android:layout_height="0dp"         android:layout_weight="1.2">          <imageview             android:layout_width="match_parent"             android:layout_height="match_parent"             android:id="@+id/serbia"             android:src="@drawable/serbia"             android:adjustviewbounds="true" />          <imageview             android:layout_width="match_parent"             android:layout_height="match_parent"             android:id="@+id/pin"             android:src="@drawable/pin"             android:adjustviewbounds="true"/>      </relativelayout> 

what causing such sudden memory increase? there way bypass such practice, still able animate each part of image separately?

note still have align these elements (the pin isn't in center of layout), because right edge of shadow cropped shape of base)

the pin , shadow may small view size same parent layout them bigger 1 (the parent) sets size of them 3 buffers painting. biggest size multiplied 3 (or four, donno how container paints itself) memory used. , biggest mean biggest in screen format, not in file compressed.

best thing paint them or stack them using framelayout , setting x , y possition... donno right if u can set thrm in xml directly but, if not, set them in code elsewhere.


Comments

Popular posts from this blog

PHP DOM loadHTML() method unusual warning -

python - How to create jsonb index using GIN on SQLAlchemy? -

c# - TransactionScope not rolling back although no complete() is called -