没有合适的资源?快使用搜索试试~ 我知道了~
先看看效果: activity_main.xml主页布局就2个button,分别弹出不同效果的2个进度条 <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android xmlns:tools=http://schemas.android.com/tools android:layout_width=match_parent android:layout_height=match_parent tools:context=com.example.dialog.MainActivity
资源推荐
资源详情
资源评论















Android常用进度条效果分享常用进度条效果分享
先看看效果:
activity_main.xml主页布局就2个button,分别弹出不同效果的2个进度条
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.dialog.MainActivity" >
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
<Button
android:id="@+id/button2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello_world" />
</LinearLayout>
MainActivity
package com.example.dialog;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
public class MainActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
findViewById(R.id.button1).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
MyloadDialog myloadDialog = new MyloadDialog(
MainActivity.this, 1);
myloadDialog.show();
}
});
findViewById(R.id.button2).setOnClickListener(
new View.OnClickListener() {
@Override
public void onClick(View v) {
MyloadDialog myloadDialog = new MyloadDialog(
MainActivity.this, 2);
myloadDialog.show();
}
});
}
}
MyloadDialog

package com.example.dialog;
import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
public class MyloadDialog extends Dialog{
public MyloadDialog(Context context,int args) {
super(context, R.style.PerfectDialog);
init(args);
}
private int barColor = Color.parseColor("#ff009688");
private void init(int args) {
if (args == 1) {
View contentView = View.inflate(getContext(),
R.layout.dialog_load_classic_layout, null);
setContentView(contentView);
LoadClassicView loadClassicView = (LoadClassicView) contentView
.findViewById(R.id.dialogLoadView);
loadClassicView.startLoad();
}else if (args == 2) {
View contentView = View.inflate(getContext(),
R.layout.dialog_load_material_layout, null);
setContentView(contentView);
LoadMaterialView progressWheel = (LoadMaterialView) contentView.findViewById(R.id.dialogLoadView);
progressWheel.setBarColor(barColor);
progressWheel.spin();
}
}
}
</style>
<style name="PerfectDialog" parent="@android:style/Theme.Dialog">
<item name="android:windowIsFloating">true</item>//是否浮现在activity之上
<item name="android:windowIsTranslucent">false</item>//是否半透明
<item name="android:windowNoTitle">true</item>//是否显示title标题
<item name="android:windowFrame">@null</item>//设置windowFrame框
<item name="android:windowFullscreen">false</item>//是否全屏显示
<item name="android:windowBackground">@android:color/transparent</item>//设置dialog的背景
<item name="android:windowAnimationStyle">@style/DialogAnims</item>//设置窗口动画效果
<item name="android:backgroundDimEnabled">true</item>//背景是否变暗
<item name="android:backgroundDimAmount">0.5</item>//设置背景变暗程度
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="android:background">@android:color/transparent</item>
</style>
<style name="DialogAnims">
<item name="android:windowEnterAnimation">@anim/enter</item>//进入动画
<item name="android:windowExitAnimation">@anim/exit</item>//退出动画
</style>
enter.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="90"
android:fromAlpha="0"
android:toAlpha="1"/>
<scale

android:duration="135"
android:fromXScale="0.8"
android:toXScale="1.05"
android:fromYScale="0.8"
android:toYScale="1.05"
android:pivotX="50%"
android:pivotY="50%"/>
<scale
android:duration="105"
android:fromXScale="1.05"
android:toXScale="0.95"
android:fromYScale="1.05"
android:toYScale="0.95"
android:startOffset="135"
android:pivotX="50%"
android:pivotY="50%"/>
<scale
android:duration="135"
android:fromXScale="0.95"
android:toXScale="1"
android:fromYScale="0.95"
android:toYScale="1"
android:startOffset="240"
android:pivotX="50%"
android:pivotY="50%"/>
</set>
exit.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<alpha
android:duration="200"
android:fromAlpha="1"
android:toAlpha="0"/>
<scale
android:duration="200"
android:fromXScale="1"
android:toXScale="0.1"
android:fromYScale="1"
android:toYScale="0.1"
android:pivotX="50%"
android:pivotY="50%"/>
</set>
首先看带第一个效果图的布局文件
dialog_load_classic_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/background_round_corner"
android:padding="35dp">
<com.example.dialog.LoadClassicView
android:id="@+id/dialogLoadView"
android:layout_width="45dp"
android:layout_height="45dp" />
</LinearLayout>
背景圆角background_round_corner.xml
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="8dp"/>
<solid android:color="#ffffff"/>
</shape>
LoadClassicView
package com.example.dialog;
剩余17页未读,继续阅读
资源评论


weixin_38667920
- 粉丝: 3
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助


最新资源
- 基于 YOLOv3 与 brox 光流的动态背景运动补偿运动目标检测算法
- 基于STC12C5410AD单片机的倾角测试系统方案设计书.doc
- 探析计算机应用技术与信息管理系统优化整合的优势.docx
- TCP网络门禁系统方案设计书实施方案书.doc
- 4GLTE的网络架构探究.docx
- 通信光缆施工工艺与规范.ppt
- 常用软件实训评测研究报告.doc
- 2009年秋季四级网络工程师模拟历年真题第1套.doc
- 企业工程项目管理用表.doc
- SQL课程研究设计会员管理系统.doc
- 基于YOLOv3和brox光流的运动目标检测算法,对动态背景进行了运动补偿
- c--面向对象程序设计方案试题和答案(经典题目).doc
- 基于任务驱动的大学计算机基础课程SPOC翻转课堂教学模式探讨.docx
- 交互式白板在中职计算机教学中有效使用的探究.docx
- 供应链优化项目管理.doc
- 建设工程项目管理模拟试卷二.doc
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈



安全验证
文档复制为VIP权益,开通VIP直接复制
