android 仿微信加载框,Android仿微信网络加载弹出框
本文实例为大家分享了Android仿微信网络加载弹出框的具体代码,供大家参考,具体内容如下
没有饿了么的动画效果好看,但是,特别适用,拿来就用!
看一下效果图
图片素材
好了,其实很简单,就是一个自定义Dialog的控件而已
1. 自定义view的style样式
@color/colorPrimary
@color/colorPrimaryDark
@color/colorAccent
@null
true
false
true
@drawable/dialog_custom_bg
false
0.6
2.dialog_custom_bg 加载动画shape背景图(drawable文件夹下)
android:shape="rectangle">
3.indeterminate_drawable 进度条模糊背景图(drawable文件夹下)
android:drawable="@drawable/loading"
android:fromDegrees="0"
android:pivotX="50%"
android:pivotY="50%"
android:toDegrees="360">
4.加载对话框的背景
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:indeterminateDrawable="@drawable/indeterminate_drawable"
android:indeterminateDuration="1800" />
android:id="@+id/tvcontent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="加载中"
android:textColor="#ffffff"
android:textSize="14sp" />
5.CustomDialog自定义控件
public class CustomDialog extends Dialog {
private String content;
public CustomDialog(Context context, String content) {
super(context, R.style.CustomDialog);
this.content=content;
initView();
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode){
case KeyEvent.KEYCODE_BACK:
if(CustomDialog.this.isShowing())
CustomDialog.this.dismiss();
break;
}
return true;
}
private void initView(){
setContentView(R.layout.dialog_view);
((TextView)findViewById(R.id.tvcontent)).setText(content);
setCanceledOnTouchOutside(true);
WindowManager.LayoutParams attributes = getWindow().getAttributes();
attributes.alpha=0.8f;
getWindow().setAttributes(attributes);
setCancelable(false);
}
}
6.Activity中直接调用
CustomDialog customDialog = new CustomDialog(this, "正在加载...");
customDialog.show();//显示,显示时页面不可点击,只能点击返回
customDialog.dismiss();//消失
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持找一找教程网。
android 仿微信加载框,Android仿微信网络加载弹出框相关推荐
- layui弹出框php,layui中使用的一些弹出框
第一步:引用文件 第二步:写脚本 //iframe窗 //layer.open({ // type: 2, // title: false, // closeBtn: 0, //不显示关闭按钮 // ...
- js实现弹出框时禁止页面滚动,关闭弹出框时恢复页面滚动
$(function () {$('#pingtai').click(function () {if($('#serviceDes').css('display','none')){$('#servi ...
- android 弹窗有边框_Android 多种简单的弹出框样式设置代码
简介 这是一个基于AlertDialog和Dialog这两个类封装的多种弹出框样式,其中提供各种简单样式的弹出框使用说明.同时也可自定义弹出框. 特性 1.使用链式开发代码简洁明了 2.所有的弹出框样 ...
- Android 多种简单的弹出框样式设置
简介 这是一个基于AlertDialog和Dialog这两个类封装的多种弹出框样式,其中提供各种简单样式的弹出框使用说明.同时也可自定义弹出框. 项目地址:https://github.com/Liu ...
- android开发自动提示框,Android 多种简单的弹出框样式设置代码
简介 这是一个基于AlertDialog和Dialog这两个类封装的多种弹出框样式,其中提供各种简单样式的弹出框使用说明.同时也可自定义弹出框. 项目地址:http://www.easck.com/j ...
- 微信小程序页面跳转、弹出框
一.页面跳转 页面跳转是微信小程序中使用较为频繁并且很重要的功能之一,页面跳转一般是通过点击按钮或者文本区域后需要进行的操作. 页面跳转中需要注意的点很多,我在这就介绍一些我在写项目过程中所遇到的一些 ...
- html 原生弹出框,html、css和js原生写一个模态弹出框,顺便解决父元素半透明子元素不透明效果...
模态框: html部分: 弹出框 hhhhh 取消 确认 css部分: #box{ width: 80px; height: 40px; background: #fd7430; border:non ...
- 【JavaScript】(9)——实例:滑动效果的弹出框
背景:用户的需求千奇百怪,为了满足用户对界面的需求,我这只小菜鸟也是"拼了小命"了.弹出框,大家都很熟悉吧,但是在弹出框中加上滑动效果,这个就是有点小难了,为了这个效果我也是搜寻了 ...
- 小程序安全设置-弹出框输入获取值
小程序安全设置 Page({/*** 页面的初始数据*/data: {anquan: '',detailanquan: '',hiddenmodalput: true,//可以通过hidden是否掩藏 ...
- php使用popover,php中bootstrap框架.popover弹出框,鼠标移动到上面自动显示,离开自动消失...
$(function(){//显示弹出框 $("[rel=name]").popover({ trigger:'manual', placement : 'bottom', //p ...
最新文章
- 【多标签文本分类】Large Scale Multi-label Text Classification with Semantic Word Vectors
- 过去50年最重要的统计学思想!
- Yii实现Password Repeat Validate Rule
- 常见动态内存的管理程序错误
- mfc c语言 编辑器,语法高亮编辑控件Scintilla在MFC中的简单使用
- python回顾(四)——面向对象
- linux安装anaconda3时出现error,the size of ** should be 6*** bytes
- RMAN的一些术语解释
- python多维数据post给php_使用Python中的POST将数据发送到PHP
- 【转】4.2SharePoint服务器端对象模型 之 使用CAML进行数据查询(Part 2)
- softlayer virtual machine vhd磁盘镜像导入shell脚本
- AHK 中的字符串拼接和遍历操作
- NodeJS学习第一季-路由规则
- docker入门实践之数据卷管理
- SpringMVC:学习笔记(2)——RequestMapping及请求映射
- 数据挖掘概念与技术(第三版)课后答案——第一章
- ubuntu 安装opensips osip exosip
- 台式计算机硬盘的安装位置,台式电脑分别如何安装SSD(固态硬盘)详细图文教程...
- 小工具--理财计算器
- 群贤路附近哪有计算机学校,群贤路口附近展览馆、会展中心
热门文章
- “伽利略”卫星定位系统
- 合肥盛荣乒乓球俱乐部学习感悟
- IE9环境下。LODOP打印,首次打印时,图片加载不出来、加载不完全问题
- html制作雪花飘落海报,HTML5 canvas实现雪花飘落特效
- 园区人工智能开启双创模式,“1+N”创新型组织发展成效初显...
- 关于互联网+分布式光伏运维平台的应用介绍-李亚俊
- 转叶寒栋分享:方舟支持C语言编译新功能开源啦!
- 兴业java入职考试是考什么_兴业银行考试考什么
- 使用Docker一键部署MongoDB
- 控件库中的Botton控件简述