自定义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" 取掉控件自带旋 ...
随机推荐
- Spring3+hibernate4+struts2整合的 过程中发生如下错误
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderLis ...
- SQL Server 之 事务隔离级别
SET TRANSACTION ISOLATION LEVEL xxx -- 每次设置只针对当前事务块 xxx 取值: READ UNCOMMITTED READ COMMITTED REPEATA ...
- jQuery+css+div一些值得注意的常用语句
一.div页面布局 一个好的页面布局很重要,这会让你写代码的时候层次分明: 以2列左侧固定右侧自适应宽度为例子: 这是HTML代码: <!DOCTYPE html PUBLIC "-/ ...
- 浅析白盒审计中的字符编码及SQL注入
尽管现在呼吁所有的程序都使用unicode编码,所有的网站都使用utf-8编码,来一个统一的国际规范.但仍然有很多,包括国内及国外(特别是非英语国家)的一些cms,仍然使用着自己国家的一套编码,比如g ...
- ssh 内在溢出
相信有一定java开发经验的人或多或少都会遇到OutOfMemoryError的问题,这个问题曾困扰了我很长时间,随着解决各类问题经验的积累以及对问题根源的探索,终于有了一个比较深入的认识. 在解决j ...
- Unity3d 一些 常见路径
Application.persistentDataPath C:\Users\Administrator\AppData\LocalLow\Company Name\Product Name 如果改 ...
- Feature Flag
know more from here: https://www.youtube.com/watch?v=WMRjj06R6jg&list=UUkQX1tChV7Z7l1LFF4L9j_g F ...
- Url重写和伪静态
这里是URL重写的精华:http://msdn.microsoft.com/zh-cn/library/ms972974.aspx感觉写的非常棒. 其实URL重写操作起来也是挺简单的,只要你在前台写好 ...
- ***php解析html类库simple_html_dom
下载地址:https://github.com/samacs/simple_html_dom 一直以来使用php解析html文档树都是一个难题.Simple HTML DOM parser 帮我们很好 ...
- kmalloc/kfree,vmalloc/vfree函数用法和区别
http://blog.csdn.net/tigerjibo/article/details/6412881 kmalloc/kfree,vmalloc/vfree函数用法和区别 1.kmalloc ...