gpt4 book ai didi

android - 带圆角、实心边框和发光效果的ImageView

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:39:40 40 4
gpt4 key购买 nike

我想将圆角和边框添加到具有自定义边框颜色的 ImageView。另外,我想用边框的颜色实现发光效果。附加示例图像。请注意,源图像具有方形边框。我想这只能通过使用 Canvas 来实现?有什么想法和示例代码吗?

enter image description here

最佳答案

这就是我为我的 ImageView 所做的,以便根据您的需要进行相同的更改。

做了一个image_shape.xml

    <?xml version="1.0" encoding="UTF-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android">
<stroke
android:width="1dp"
/>
<corners
android:radius="50dp" />

<padding
android:left="10dp"
android:right="10dp"
android:top="10dp"
android:bottom="10dp"/>


<solid android:color="#10151D"/>

</shape>

现在,将此 xml 作为您的 imageView 的背景,然后您将获得您想要的效果。现在我已经设置了自己的颜色。你可以把你想要的颜色和效果作为圆形发光边框效果。

关于android - 带圆角、实心边框和发光效果的ImageView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13685256/

40 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com