[img]
[/img]
工程结构图:
[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里面自定义