直播系统代码,Android自定义View实现呼吸灯效果

发布时间 2023-11-28 14:04:21作者: 云豹科技-苏凌霄

直播系统代码,Android自定义View实现呼吸灯效果

自定义View的属性定义 attrs.xml 如下:

 


<resources>
    <declare-styleable name="BreathView">
        <attr name="centerCircleRadius" format="dimension"/>
        <attr name="circleColor" format="color"/>
        <attr name="maxCircleRadius" format="dimension"/>
    </declare-styleable>
</resources>
 

其中通过 centerCircleRadius 属性定义中间圆形的大小,为0时则不显示中间圆形;通过 maxCircleRadius 属性定义圆形最大显示半径,circleColor 属性为圆形颜色。

在界面中定义如下:

 


    <com.example.customui.BreathView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:centerCircleRadius="3dp"
        app:maxCircleRadius="8dp"
        app:circleColor="@android:color/holo_red_light" />

 

 以上就是直播系统代码,Android自定义View实现呼吸灯效果, 更多内容欢迎关注之后的文章