本文介绍: 文章浏览阅读1.7k次。Android layerlist(3)在附录文章3、4的基础上,就Android layerlist再写一个较为复杂应用先写布局文件,该布局涉及到LinearLayoutCompat关于LinearLayoutCompat参看附录文章5。文章浏览阅读1.2k次。Android layerlist:联合shape(2)-CSDN博客。Android layerlist(3)-CSDN博客

Android drawable layerlist右上角红点,xml布局实现,Kotlin

 

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/pic"
        android:drawable="@mipmap/ic_launcher"></item>
    <item
        android:id="@+id/circle"
        android:width="15dp"
        android:height="15dp"
        android:gravity="right|top">
        <shape android:shape="oval">
            <solid android:color="@android:color/holo_red_light" />

            <stroke
                android:width="5px"
                android:color="@android:color/holo_blue_dark" />
        </shape>
    </item>
</layer-list>

 

e6538e2625a84a6da042f501ca0a78dd.png

 

点击图片,小红点消失

        val iv = findViewById<ImageView>(R.id.iv)
        iv.setOnClickListener { v ->
            ((v as ImageView).drawable as LayerDrawable).findDrawableByLayerId(
                R.id.circle
            ).alpha = 0
        }

 

 

Android layerlist:联合shape(2)-CSDN博客文章浏览阅读1.2k次。Android layerlist:联合shape(2)附录文章3简单说明了Android layerlist的用法,现在把Android layerlist联合shape做出一些特殊应用,和附录文章3类似,先写布局文件https://blog.csdn.net/zhangphil/article/details/51721283Android layerlist(3)-CSDN博客文章浏览阅读1.7k次。Android layerlist(3)在附录文章3、4的基础上,就Android layerlist再写一个较为复杂的应用。先写布局文件,该布局涉及到LinearLayoutCompat关于LinearLayoutCompat参看附录文章5。布局文件activity_main.xmlhttps://blog.csdn.net/zhangphil/article/details/51721816

 

 

原文地址:https://blog.csdn.net/zhangphil/article/details/134689524

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任

如若转载,请注明出处:http://www.7code.cn/show_48896.html

如若内容造成侵权/违法违规/事实不符,请联系代码007邮箱suwngjj01@126.com进行投诉反馈,一经查实,立即删除

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注