From this developer guide about Layer-list drawables,
All drawable items are scaled to fit the size of the containing View, by default. Thus, placing your images in a layer list at different positions might increase the size of the View and some images scale as appropriate.
In the first sentence, they say that the items are scaled to fit the container view (and Not that the view is scaled according to the size of the items contained in it). Then they say that the size of the container view might increase (which means that the View is being scaled, right?). So doesn't the second sentence contradict the first one? Can somebody explain what is meant there?
android:drawable
Drawable resource. Required. Reference to a drawable resource.
...
To avoid scaling items in the list, use a element inside the element to specify the drawable...
...
For example, the following defines an item that scales to fit its container View:
<item android:drawable="@drawable/image" />To avoid scaling, the following example uses a element with centered gravity:
<item> <bitmap android:src="@drawable/image" android:gravity="center" /> </item>Again, they say that
android:drawableis a required attribute, and then they give an example which does not use this attribute. What is correct?To avoid scaling items in the list, use a
<bitmap>element inside the<item>element to specify the drawable and define the gravity to something that does not scale, such as "center"How is
gravityscalable and how iscenteras its value make it unscalable?