Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use several 9 patch images inside LayerDrawable?

I want to use two nine patches inside LayerDrawable

   <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
       <item android:id="@+id/solid">
           <nine-patch android:src="@drawable/button_header_solid" android:dither="true" />
       </item>
       <item android:id="@+id/transparent">
           <nine-patch android:src="@drawable/button_header_transparent" android:dither="true" />
       </item>
   </layer-list>

And it seems that only first layer is stretched while second one stays as is.

Both images are of the same size as .png, and have equal stretchable and padding areas.

The question is: Do we allowed to use several 9-patches (in one layer-list) or only one is allowed?

Thanks.

like image 809
woodshy Avatar asked May 21 '11 09:05

woodshy


1 Answers

Just now faced with the same problem. Try this:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
       <item android:id="@+id/solid">
           <nine-patch android:src="@drawable/button_header_solid" android:dither="true" />
       </item>
       <item android:id="@+id/transparent">
           <clip>
              <nine-patch android:src="@drawable/button_header_transparent" android:dither="true" />
           </clip>
       </item>
   </layer-list>
like image 92
pleerock Avatar answered Sep 20 '22 21:09

pleerock