自定义progressbar

<ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/transparent"
android:indeterminateDrawable="@drawable/progressbar" />
progressbar.xml
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360" > <shape
android:innerRadiusRatio="3"
android:shape="ring"
android:thicknessRatio="8"
android:useLevel="false" >
<gradient
android:centerColor="@color/title_color"
android:centerY="0.50"
android:endColor="@color/title_color"
android:startColor="@color/transparent"
android:type="sweep"
android:useLevel="false" />
</shape> </animated-rotate>
全部代码
<style name="Animation.Dialog">
<item name="windowEnterAnimation">@anim/dialog_enter</item>
<item name="windowExitAnimation">@anim/dialog_exit</item>
</style>
<!-- 更多登录等待框的样式 -->
</style>
<style name="loadingDialogStyle" parent="android:Theme.Dialog">
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowContentOverlay">@null</item>
<!-- 对话框是否有遮盖 -->
<item name="android:windowAnimationStyle">@android:style/Animation.Dialog</item>
<item name="android:backgroundDimEnabled">true</item>
</style>
public class ThirdLoginLoadingDialog extends Dialog {
private TextView tv;
public ThirdLoginLoadingDialog(Context context) {
super(context, R.style.loadingDialogStyle);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_thirdlogin_dialog_loading);
tv = (TextView) this.findViewById(R.id.tv);
tv.setText("正在登录...");
LinearLayout linearLayout = (LinearLayout) this
.findViewById(R.id.LinearLayout);
linearLayout.getBackground().setAlpha(0);
}
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent"
android:gravity="center"
android:orientation="vertical" > <LinearLayout
android:id="@+id/LinearLayout"
android:layout_width="160dp"
android:layout_height="160dp"
android:background="@drawable/thirdlogin_dialog_bg"
android:gravity="center"
android:orientation="vertical" > <ProgressBar
android:id="@+id/progressBar1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/transparent"
android:indeterminateDrawable="@drawable/progressbar" /> <TextView
android:id="@+id/tv"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:paddingTop="10dp"
android:textColor="@android:color/white" />
</LinearLayout> </LinearLayout>
最后 在主活动中加上
private ThirdLoginLoadingDialog dialog;
dialog = new ThirdLoginLoadingDialog(this);
dialog.setCanceledOnTouchOutside(false);//防止触摸其他地方,程序报错
dialog.show();
dialog.dismiss();
自定义progressbar的更多相关文章
- Android ProgressBar分析及自定义ProgressBar
ProgressBar是在执行耗时操作时的一种人性化设计.分为两种形式:转圈的,能显示进度的. 而能取决于是什么样式的PregressBar,当然就是PregressBar的样式啦~ Widget.P ...
- Android三种实现自定义ProgressBar的方式介绍
一.通过动画实现 定义res/anim/loading.xml如下: View Row Code<?xml version="1.0" encoding="UTF- ...
- Android自定义ProgressBar样式
我们使用的进度条多种多样,下面有几种自定义的进度条的样式,下面介绍几个. 进度条的有基本的四种样式: 默认风格的进度条: android:progressBarStyle 水平长型进度条: andro ...
- 自定义ProgressBar的加载效果
三种方式实现自定义圆形页面加载中效果的进度条 To get a ProgressBar in the default theme that is to be used on white/light b ...
- android 自定义progressbar 样式
在res下创建drawable文件夹,新建文件drawable/progressbar_color.xml <layer-list xmlns:android="http://sche ...
- Android中自定义ProgressBar
<ProgressBar android:id="@+id/more_vprogress_more" android:layo ...
- 自定义progressBar的旋转圆圈
在手工打造下拉刷新功能 自带的progressBar太丑了 做个也不费事,一个简单的圆形 旋转动画加type是sweep的gradient渐变 <rotate //旋转动画xmlns:andro ...
- Android自定义progressBar
通过继承系统ProgressBar实现 效果图 实现 HorizontalProgressBarWithNumber 自定义属性 <?xml version="1.0" en ...
- android 项目学习随笔十(自定义ProgressBar)
android:innerRadius 内部半径 android:thickness 厚度 gradient 渐变 android:useLevel="false" 取掉控件自带旋 ...
随机推荐
- MVC3 ModelBinder
1.Model Binder从哪些地方获取数据(找到数据后会停止继续寻找) MVC 框架内置默认的 Model Binder 是 DefaultModelBinder 类.当 Action Invok ...
- curPos和tgtPos
curpos tgtpos 乍一看以为是当前位置和目标位置,但在项目里面这两个位置有点坑 当客户端玩家移动或者AI里面的位置,会把获得的位置付给tgtpos 而以前的tgtpos会付给curpos 所 ...
- Eclipse插件开发
最近在做Eclipse的插件开发,目前是在Eclipse3.x环境上进行开发,之后迁移到Eclipse4.x环境.会贡献在插件开发过程中遇到的所有问题以及相关技巧,敬请期待. SWT开发 JFace开 ...
- T-SQL操作表结构(转)
在网上整理的一牛人资料,收集与此与君共享 用SQL语句添加删除修改字段1.增加字段 ALTER TABLE [yourTableName] ADD [newColumnName] newCo ...
- hdu 1754 线段树入门
线段树点修改 区间最大值查询 #include <cstdio> #include <cstdlib> #include <cmath> #include < ...
- leetcode Largest Rectangle in Histogram 解法二
上一篇文章讲了该题的一个解法.后来又发现一个更好的解法. 首先依旧考虑一个升序的数列,例如1,2,3,4,5.那么它的最大矩形显然是有5种可能,即 1*5,2*4,3*3,4*2,1*5.所以最大的矩 ...
- linux源代码阅读笔记 linux文件系统(转)
linux文件系统: 操作系统的文件数据除了文件实际内容外,还有非常多的属性,如文件权限(rwx)与文件属性(所有者.群组.时间参数等). 文件系统通常将这两部分数据存放在不同的块.权限属性放 ...
- SDUT2141数据结构实验图论一:基于邻接矩阵的广度优先搜索遍历
http://acm.sdut.edu.cn/sdutoj/showproblem.php?pid=2141&cid=1186 #include<cstdio> #include& ...
- Android Drawable 关于selector中state_pressed="true"的位置顺序
界面中有一个按钮使用这样的样式: <?xml version="1.0" encoding="utf-8"?> <selector xmlns ...
- Project Euler 86:Cuboid route 长方体路径
Cuboid route A spider, S, sits in one corner of a cuboid room, measuring 6 by 5 by 3, and a fly, F, ...