跳转到帖子

游客您好,欢迎来到黑客世界论坛!您可以在这里进行注册。

赤队小组-代号1949(原CHT攻防小组)在这个瞬息万变的网络时代,我们保持初心,创造最好的社区来共同交流网络技术。您可以在论坛获取黑客攻防技巧与知识,您也可以加入我们的Telegram交流群 共同实时探讨交流。论坛禁止各种广告,请注册用户查看我们的使用与隐私策略,谢谢您的配合。小组成员可以获取论坛隐藏内容!

TheHackerWorld官方

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

精选回复

发布于

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

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

 

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

 

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

 

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

 

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

 

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

 

自定义背景条seekbar_background.xml

 

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

 

布局文件中的代码如下:

 

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

 

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

 

创建帐户或登录后发表意见

最近浏览 0

  • 没有会员查看此页面。