5

I have used the <layer-list> tag in android quite often to do various stuff like adding shadows and background to views, creating custom shapes, etc. Whatever I needed was always there some where on the internet. So I copied it and used it as it is.

But I want to know how <layer-list> actually works? How <items> are ordered to achieve the right shape or effect? I want to know so that every time when there is a need for some custom shape or effect I can do it by myself.

I consider <layer-list> a very powerful tool in android to create anything you want. I have done a decent amount of search on it since the time I am developing on android but I wasn't able to find any proper documentation or tutorial where there could be something like a step-by-step guide or explanation to create the shape or effect of your choice.

If someone can explain it to me then that would be great. Thanks in advance!!

Ashwani Kumar
  • 1,402
  • 1
  • 19
  • 26
  • Possible duplicate of [Understanding Android's ](http://stackoverflow.com/questions/14436641/understanding-androids-layer-list) – Rajen Raiyarela Nov 09 '16 at 05:46
  • @RajenRaiyarela I have gone through this question's answer already. But there also the answers are specific to just one figure as asked in the question. I want a general solutions/guide to all possible figures. Thus I don't consider it as duplicate of this question. – Ashwani Kumar Nov 09 '16 at 05:51
  • see [here](http://androidxref.com/7.0.0_r1/xref/frameworks/base/graphics/java/android/graphics/drawable/LayerDrawable.java#70) – pskink Nov 09 '16 at 06:17
  • 1
    Have you ever considered to just [**look at the source code**](http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/5.1.1_r1/android/graphics/drawable/LayerDrawable.java#LayerDrawable)? If you want to know how it works then there is no better place to start. – Xaver Kapeller Nov 09 '16 at 11:03
  • I did but I wasn't able to understand that. @XaverKapeller – Ashwani Kumar Nov 10 '16 at 05:16

0 Answers0