Android-自定义进度条
圆形进度条,不确定进度条:
<!-- 原生圆形进度条 不确定进度条 -->
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content" /> <!--
自定义圆形进度条 不确定进度条
android:indeterminateDrawable="@drawable/progress_bar1"
-->
<ProgressBar
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateDrawable="@drawable/progress_bar1"
android:layout_marginTop="20dp"
/>
android:indeterminateDrawable="@drawable/progress_bar1" 的progress_bar1.xml:
<?xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:pivotX="50%"
android:pivotY="50%"
android:fromDegrees="0"
android:toDegrees="360"
android:interpolator="@android:anim/accelerate_decelerate_interpolator"> <!--进度条图片-->
<bitmap
android:antialias="true"
android:filter="true"
android:src="@drawable/share_circle"/> </rotate>
效果:

水平方向进度条:
<!-- 原生水平进度条 -->
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:max="100"
android:progress="50"
android:layout_marginTop="20dp"
/> <!--
自定义水平样式 进度条
android:progressDrawable="@drawable/progress_bar2"
-->
<ProgressBar
android:layout_width="match_parent"
android:layout_height="wrap_content" style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:max="200"
android:progress="100"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp" android:progressDrawable="@drawable/progress_bar2"
/>
android:progressDrawable="@drawable/progress_bar2" 的progress_bar2.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <!-- 背景 gradient是渐变,corners定义的是圆角 -->
<item android:id="@android:id/background">
<shape>
<corners android:radius="10dp" /> <solid android:color="#ffffff" />
</shape>
</item> <!-- 第二条进度条颜色 -->
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="10dip" /> <gradient
android:angle="90.0"
android:centerColor="#ac6"
android:centerY="0.45"
android:endColor="#6c2"
android:startColor="#e71a" />
</shape>
</clip>
</item> <!-- 进度条 -->
<item android:id="@android:id/progress">
<clip>
<shape>
<corners android:radius="10dip" /> <solid android:color="#F5e5" />
</shape>
</clip>
</item> </layer-list>
效果:

Android-自定义进度条的更多相关文章
- android 自定义进度条颜色
android 自定义进度条颜色 先看图 基于产品经理各种自定义需求,经过查阅了解,下面是自己对Android自定义进度条的学习过程! 这个没法了只能看源码了,还好下载了源码, sources\b ...
- 最简单的android自定义进度条样式
一.自定义圆形进度条样式 1.在安卓项目drawable目录下新建一个xml文件如下:<?xml version="1.0" encoding="utf-8&quo ...
- Android自定义进度条颜色
这个没法了只能看源码了,还好下载了源码, sources\base\core\res\res\ 下应有尽有,修改进度条颜色只能找progress ,因为是改变样式,首先找styles.xml ? 1 ...
- Android自定义进度条
Android原生控件只有横向进度条一种,而且没法变换样式,比如原生rom的样子很丑是吧,当伟大的产品设计要求更换前背景,甚至纵向,甚至圆弧状的,咋办,比如ok,我们开始吧: 一)变换前背景 先来看看 ...
- Android自定义进度条-带文本(文字进度)的水平进度条(ProgressBar)
水平进度条,显示进度的文本随着进度而移动. 效果如下,截的静态图. 代码如下 TextProgressBar.java public class TextProgressBar extends Pro ...
- android113 自定义进度条
MainActivity: package com.itheima.monitor; import android.os.Bundle; import android.app.Activity; im ...
- 自定义进度条PictureProgressBar——从开发到开源发布全过程
自定义进度条PictureProgressBar——从开发到开源发布全过程 出处: 炎之铠邮箱:yanzhikai_yjk@qq.com 本文原创,转载请注明本出处! 本项目JCenter地址:htt ...
- Android 设置进度条背景
Android 设置进度条背景 直接上代码 <ProgressBar android:id="@+id/progressBar" android:layout_width=& ...
- Qt之模型/视图(自定义进度条)
简述 在之前的章节中分享过关于QHeaderView表头排序.添加复选框等内容,相信大家模型/视图.自定义风格有了一定的了解,下面我们来分享一个更常用的内容-自定义进度条. 实现方式: 从QAbstr ...
- Android之进度条2
我之前有写过一篇“Android之进度条1”,那个是条形的进度条(显示数字进度),这次实现圆形进度条. 点击查看Android之进度条1:http://www.cnblogs.com/caidupin ...
随机推荐
- TCP/IP协议详解之广播和多播
广播和多播仅应用于 U D P,它们对需将报文同时传往多个接收者的应用来说十分重要.T C P是一个面向连接的协议,它意味着分别运行于两主机(由 I P地址确定)内的两进程(由端口号确定)间存在一条连 ...
- leetcode575
public class Solution { public int DistributeCandies(int[] candies) { var dic = new Dictionary<in ...
- 利用Console来学习、调试JavaScript
一 什么是 Console Console 是用于显示 JS和 DOM 对象信息的单独窗口.并且向 JS 中注入1个 console 对象,使用该对象 可以输出信息到 Console 窗口中. 二 ...
- git服务器搭建问题
CentOS6.5本地搭建. 对于图形化的系统,可以联网,然后CTRL+ALT+F2可以切换到命令行,CTRL+ALT+F1可以切换回桌面图形化. 可以用SSH和FTP来连接服务器和传文件. (1 ...
- 03.什么是Lucene全文检索的原理01
全文检索的原理:查询速度快,精准度高,可以根据相关度进行排序.它的原理是:先把内容分词,分词之后建索引. Lucene是apache下的一个开放源代码的全文检索引擎工具包. 提供了完整的查询引擎和索引 ...
- 109. Convert Sorted List to Binary Search Tree (List; Divide-and-Conquer, dfs)
Given a singly linked list where elements are sorted in ascending order, convert it to a height bala ...
- 29-中国剩余定理CRT
https://blog.csdn.net/u010468553/article/details/38346195 中国剩余定理[数论] 2014年08月02日 12:55:59 阅读数:2351 中 ...
- shiro 集成spring 配置 学习记录(一)
首先当然是项目中需要增加shiro的架包依赖: <!-- shiro --> <dependency> <groupId>org.apache.shiro</ ...
- 要生成在[min,max]之间的随机整数,
import java.util.Random; public class RandomTest { public static void main(String[] args) { int max= ...
- Cocos2dx之touch事件
今天看了下ccocos2dx touch事件部分的源码,从CCTouch.CCTouchHandler和CCTouchDispatcher简单的做了分析和总结,先直接看源码吧! 1.CCTouch c ...