直播系统app源码,自定义中间向两边滑动的滑动条

直播系统app源码,自定义中间向两边滑动的滑动条

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

 

1
    <declare-styleable name="CenterSeekBar"><br>        <attr name="max" format="integer" /><br>        <attr name="min" format="integer" /><br>        <attr name="progress" format="integer" /><br>        <attr name="thumb" format="reference" /><br>        <attr name="progressDrawable" format="reference" /><br>        <attr name="backgroundDrawable" format="reference" /><br>    </declare-styleable>

 

自定义滑动圆点seekbar_thumb_selector.xml如下:

 

1
<?xml version="1.0" encoding="utf-8"?><br><selector xmlns:android="http://schemas.android.com/apk/res/android"><br>    <item android:drawable="@mipmap/seekbar_pre" android:state_pressed="true"/><br>    <item android:drawable="@mipmap/seekbar_pre" android:state_focused="true"/><br>    <item android:drawable="@mipmap/seekbar_nor" /><br></selector>

 

自定义渐变的滑动条seekbar_progress.xml

 

1
<?xml version="1.0" encoding="utf-8"?><br><shape xmlns:android="http://schemas.android.com/apk/res/android"><br>    <corners android:radius="6dp" /><br>    <gradient<br>        android:endColor="#ffb05c"<br>        android:startColor="#ff7611" /><br></shape>

 

自定义背景条seekbar_background.xml

 

1
<?xml version="1.0" encoding="utf-8"?><br><shape xmlns:android="http://schemas.android.com/apk/res/android"><br>    <corners android:radius="6dp" /><br>    <solid android:color="#66ccddff" /><br></shape>

 

布局文件中的代码如下:

 

1
    <com.example.myapplication.CenterSeekBar<br>        android:layout_width="300dp"<br>        android:layout_height="wrap_content"<br>        android:minHeight="12dp"<br>        android:layout_centerInParent="true"<br>        app:progressDrawable="@drawable/seekbar_progress"<br>        app:thumb="@drawable/seekbar_thumb_selector"<br>        app:backgroundDrawable="@drawable/seekbar_background"<br>        app:max="20" />

 

以上就是 直播系统app源码,自定义中间向两边滑动的滑动条,更多内容欢迎关注之后的文章

 

posted @   云豹科技-苏凌霄  阅读(65)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列01:轻松3步本地部署deepseek,普通电脑可用
· 25岁的心里话
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示