zoukankan      html  css  js  c++  java
  • android 自定义Style初探---ProgressBar

    系统自带的ProgressBar太丑了,所以我决定自定义一个Style。

    原来的Style

    <?xml version="1.0" encoding="utf-8"?>
    <layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:id="@android:id/background">
    <shape >
    <corners android:radius="5dp">

    </corners>
    <gradient
    android:startColor="#ff9d9e9d"
    android:centerColor="#ff5a5d5a"
    android:centerY="0.75"
    android:endColor="#ff747674"
    android:angle="270"
    />

    </shape>

    </item>

    <item android:id="@android:id/secondaryProgress">
    <clip
    >
    <shape>
    <corners android:radius="5dp"/>
    <gradient
    android:startColor="#80ffd300"
    android:centerColor="#80ffb600"
    android:centerY="0.75"
    android:endColor="#a0ffcb00"
    android:angle="270"
    />
    </shape>
    </clip>
    </item>

    <item android:id="@android:id/progress">
    <clip>
    <shape>
    <corners android:radius="5dp"></corners>
    <gradient
    android:startColor="#ffffd300"
    android:centerColor="#ffffb600"
    android:centerY="0.75"
    android:endColor="#ffffcb00"
    android:angle="270"
    />
    </shape>
    </clip>

    </item>

    </layer-list>


    自定义之后的:

    progressbarcolor.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:drawable="@drawable/bg_progress"
    >

    </item>
    <item android:id="@android:id/secondaryProgress">
    <clip
    >
    <shape>
    <corners android:radius="5dp"/>
    <gradient
    android:startColor="#80ffd300"
    android:centerColor="#80ffb600"
    android:centerY="0.75"
    android:endColor="#a0ffcb00"
    android:angle="270"
    />
    </shape>
    </clip>
    </item>

    <item android:id="@android:id/progress" android:drawable="@drawable/draw_progress">


    </item>

    </layer-list>


    <style name="my_pb_style" parent="@android:style/Widget.ProgressBar.Horizontal">
            <item name="android:progressDrawable">@drawable/progressbarcolor</item>
        </style>

    其中,还需要两张图片:

    VjmAj2B.png!web.png

    AZBVVzU.png!web.png

    重点在于研究系统的Style如何实现,然后自己模仿实现,在于这种学习的方法.

  • 相关阅读:
    SCOI2007 组队
    ZJOI2008 生日聚会
    织梦标签截取指定数目字符
    HTML特殊符号对照表
    DedeCMS让{dede:list}标签支持weight权重排序
    PHP 5.4 中经 htmlspecialchars 转义后的中文字符串为空,DeDeCMS在PHP5.4下编辑器中文不显示问题
    把图文内容载入微应用中
    织梦安装错误
    dedecms创建或修改目录失败
    安装phpmyadmin
  • 原文地址:https://www.cnblogs.com/lzh-Linux/p/5089190.html
Copyright © 2011-2022 走看看