欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

Android SeekBar 统计

程序员文章站 2022-03-20 23:05:51
1.原生

1.原生

Android SeekBar 统计

  <SeekBar
            android:id="@+id/seekBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:progressBackgroundTint="@color/yellow"
            android:progressTint="@color/black"
            android:secondaryProgress="40"
            android:secondaryProgressTint="#C00"
            android:secondaryProgressTintMode="multiply"
            android:thumb="@drawable/oval_background"

            android:minHeight="@dimen/x10"
            android:maxHeight="@dimen/x10"

            />

<!--        thumb 设置图标-->
<!--        progressBackgroundTint 背景颜色-->
<!--        progressTint 设置进度颜色-->
<!--        secondaryProgressTint 二级进度颜色-->

 

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">

    <size
        android:width="@dimen/x20"
        android:height="@dimen/x20"
        />
    <solid android:color="#60f0" />

</shape>

 无奈在修改线条宽度 /高度的时候遇到问题

2.Android SeekBar 统计

seekbar_progress_drawavle.xml

 <SeekBar
            android:id="@+id/seekBar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/x40"

            android:progressDrawable="@drawable/layer_progress"
            android:secondaryProgress="40"
            android:thumb="@drawable/oval" />

oval

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">

    <!-- solid表示远的填充色 -->
    <solid android:color="#16BC5C" />
    <!-- size控制高宽 -->
    <size
        android:height="20dp"
        android:width="20dp" />

</shape>

layer_progress.xml

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@android:id/background"
        android:height="6dp"
        android:gravity="center_vertical">
        <shape>
            <corners android:radius="2dp" />
            <solid android:color="#c00" />
        </shape>
    </item>
    <item
        android:id="@android:id/secondaryProgress"
        android:height="6dp"
        android:gravity="center_vertical">
        <clip>
            <shape>
                <corners android:radius="2dp" />
                <solid android:color="#000" />
            </shape>
        </clip>
    </item>
    <item
        android:id="@android:id/progress"
        android:height="6dp"
        android:gravity="center_vertical">
        <clip>
            <shape>
                <corners android:radius="2dp" />
                <solid android:color="#16BC5C" />
            </shape>
        </clip>
    </item>
</layer-list>

 

放入图片需谨慎...

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:drawable="@drawable/ccc"
        android:width="@dimen/x20"
        android:height="@dimen/x20">
    </item>
</layer-list>

 

 

 

 

 

 

 

 

 

 

 

 

本文地址:https://blog.csdn.net/FlyPig_Vip/article/details/110529924