从上图中显着可以发现,Tail非常短,而且随着笔墨越多,Tail 越短,长笔墨险些Tail直接不可见了,好家伙!
看起来像是Tail随着笔墨的长度被拉伸没了,于是又想到,资源Tail.svg应该保持原有宽高巨细,然后给<item 标签设置了android:width 和android:height属性,但android studio编译器提示了,width和height只在API 23 之后才支持,这......岂非这个小小东西我要通过java代码的方式自界说view来实现?我不想这么干,于是google搜刮框里敲了关键字 “android layer-list item size”,
固然没有找到能直接办理的方案,但有一片文章
https://stackoverflow.com/questions/10706853/android-how-to-change-item-width-and-height 第3个回复这段话给我了一点启示:
The above solution takes advantage of having a sized <item> (with a transparent <shape>) and an unsized one (with a <bitmap>) that has android:gravity set to left|top|right|bottom for matching both parent's dimensions. So, the real size of the <bitmap> will be determined by that of the unique sized <item> in the same parent.
仍然是上面的代码,我给<item加上了android:gravity="end|right|bottom"完满,效果如下: