ProgressBar的几个小样及自定义圆形ProgressBar半径大小 .

先看下效果图:
[img]
[img]http://dl.iteye.com/upload/attachment/0071/4989/8bb7c287-7ac8-354a-8d6b-a0385f451ce7.jpg[/img]
[/img]

工程结构图:
[img]
[img]http://dl.iteye.com/upload/attachment/0071/4997/7c15eaad-fbd7-3475-a433-2dd4593e6076.jpg[/img]
[/img]

关于Android ProgressBar自定义的问题,网上有许多解决方案,但很少提到自定义其大小的问题,尤其是圆形的ProgressBar,你可以根据网上其他的文章找到如何修改它颜色或起始位置的解决方法,这里仅介绍一下如何改变圆形ProgressBar大小的技巧
改变圆形ProgressBar大小需要重写ProgressBar的style

在style文件中加入:
<?xml version="1.0" encoding="utf-8"?>
<!--
/*
* Copyright 2011 Sina.
*
* Licensed under the Apache License and Weibo License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.open.weibo.com
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<style name="CustomProgressStyle" parent="@android:style/Widget.ProgressBar.Large">
<item name="android:minWidth">100dip</item>
<item name="android:maxWidth">100dip</item>
<item name="android:minHeight">100dip</item>
<item name="android:maxHeight">100dip</item>
</style>
</resources>


在ProgressBar的属性中写入:
<ProgressBar 
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminate="true"
style="@style/CustomProgressStyle"
android:indeterminateDrawable="@drawable/progressbar"
/>



OK,这个园就画好了,当然,你如果需要其他效果,也可以在style里面自定义
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值