Issue
When I have an xml layout like:
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_image" />
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/my_image" />
Then there are 2 instances of the bitmap associated with drawable in memory or just one?
Solution
You can find the answer here :
For instance, every time you create a Button, a new drawable is loaded from the framework resources (android.R.drawable.btn_default). This means all buttons across all the apps use a different drawable instance as their background. However, all these drawables share a common state, called the "constant state."
source: https://android-developers.googleblog.com/2009/05/drawable-mutations.html?m=1
Answered By - Abhisek Mallick
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.