无法理解图层列表

编程入门 行业动态 更新时间:2024-10-25 07:18:06
本文介绍了无法理解图层列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="schemas.android/apk/res/android"> <item android:top="4dp" android:right="4dp" android:bottom="4dp" android:left="4dp"> <shape android:shape="oval"> <solid android:color="#ff0000" /> </shape> </item> <item> <shape android:shape="oval"> <stroke android:width="2dp" android:color="#ff0000"/> </shape> </item> </layer-list>

从这里获取:

stackoverflow/a/36003935/6007737

它如何给我一个环形?

How is it giving me a ring shape?

layer-list的工作原理以及顶部,右侧的作用是什么?

How layer-list works and What do top, right, bottom and left attributes of item tag do?

不能只用环形形状吗?为什么要用椭圆形做成环形形状呢? / p>

Cant we just use ring shape ?Why go for oval shape to make ring shape?

推荐答案

层列表是可绘制的,称为带有的其他可绘制对象的序列< item> 标记。 从您的问题中,第一个< item> 是内部椭圆形&上,下,右&左边是赋予该项目的插图(与填充相同)。尝试提供宽度&首先,您可以看到椭圆形的内部形状,外部椭圆形具有4dp填充。

A layer list is drawable, called sequence of other drawables with <item> tag. Here from your question the first <item> is inner oval shape & top, bottom, right & left are insets given to that item (just same as padding). Try to give width & height to first you can see inner oval shape with 4dp padding from outer oval.

有关可绘制图层的详细信息,请参见此链接 developer.android/reference/android/graphics/drawable/LayerDrawable.html

Refer to this link for more detail about layer drawable developer.android/reference/android/graphics/drawable/LayerDrawable.html

是的,您可以使用环形形状像这样绘制圆环:

Yes you can use ring shape to draw a ring like:

<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="schemas.android/apk/res/android" android:shape="ring" android:innerRadius="15dp" android:thickness="10dp" android:useLevel="false"> <solid android:color="#ff0000" /> </shape>

更多推荐

无法理解图层列表

本文发布于:2023-07-27 14:00:58,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1222742.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:图层   列表

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!