android的弹窗和几种动画的用法_2017.09.14
来源:互联网 发布:数据实时可视化 编辑:程序博客网 时间:2024/05/17 07:15
android的弹窗和几种动画的用法
1.AlertDialog的用法:
1.弹窗:
AlertDialog bulder=new AlertDialog.Builder(this)
.setTitle("标题" ) .setMessage("简单消息框" ) .setPositiveButton("确定" , null ) .show();
//.setIcon(android.R.drawable.ic_dialog_info) 输入一个文本
2.单选框:
ew AlertDialog.Builder(self) .setTitle("请选择" ) .setIcon(android.R.drawable.ic_dialog_info) .setSingleChoiceItems(new String[] {"选项1", "选项2", "选项3" , "选项4" }, 0 , new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } } ) .setNegativeButton("取消" , null ) .show();
2.多选宽():
AlertDialog.Builder builder = new AlertDialog.Builder(this); builder .setTitle("天王盖地虎") .setMultiChoiceItems(new String[]{"sd","dsds","dsds"},null,null) .setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }) .setNegativeButton("取消", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }) .show();
3.列表框
new AlertDialog.Builder(self) .setTitle("列表框" ) .setItems(new String[] {"列表项1", "列表项2", "列表项3" }, null ) .setNegativeButton("确定" , null ) .show();
2.动画:
1. AlphaAnimation(渐变动画)
RelativeLayout rl_splash = (RelativeLayout) findViewById(R.id.rl_splash); //播放动画效果 AlphaAnimation animation = new AlphaAnimation(1.0f, 0.0f); //设置Alpha动画的持续时间 animation.setDuration(2000); //播放Alpha动画 rl_splash.setAnimation(animation);
2. RotateAnimation(旋转动画)
//相对于自身的哪个位置旋转,这里是相对于自身的右下角 RotateAnimation ra = new RotateAnimation(0, 360, //从哪旋转,旋转多少度 Animation.RELATIVE_TO_SELF, 1.0f, Animation.RELATIVE_TO_SELF, 1.0f); ra.setDuration(800); ra.setRepeatCount(Animation.INFINITE); ra.setRepeatMode(Animation.RESTART); iv_scan.startAnimation(ra);
3. ScaleAnimation(缩放动画)
ScaleAnimation(float fromX, float toX, float fromY, float toY) Constructor to use when building a ScaleAnimation from code
4. TranslateAnimation(位移动画)
TranslateAnimation(int fromXType, float fromXValue, int toXType, float toXValue, int fromYType, float fromYValue, int toYType, float toYValue) Constructor to use when building a TranslateAnimation from code
5. AnimationSet (多组动画)
AnimationSet set = new AnimationSet(false);//如果想播放多种动画的组合,这里就要用到了AnimationSet set.addAnimation(sa); set.addAnimation(ta); contentView.startAnimation(set); // 播放一组动画.
9/14/2017 8:02:08 PM
阅读全文
0 0
- android的弹窗和几种动画的用法_2017.09.14
- android的几种动画
- android动画 fillBefore 和 fillAfter的用法
- android动画的用法
- android的那几种动画
- android动画的几种形式
- UITableViewCell和UICollectionView的几种动画
- jquery 停止动画 stop的几种用法
- jquery 停止动画 stop的几种用法
- Po_python_lesson3_list和tuple的区别_2017/7/23
- Android中的tween动画, 帧动画, 和3.0以后的属性动画的用法及不同!
- Android Intent的几种用法
- Android Intent的几种使用用法
- Android Intent的几种用法
- Android Intent 的几种用法
- Android Intent的几种用法
- Android Adapter的几种用法
- android dialog常见的几种用法
- Hibernate持久化技术
- 0-6矩阵
- L2-018. 多项式A除以B
- 大文件Excel,csv等快速导入数据库
- 数据结构作业——动态数组
- android的弹窗和几种动画的用法_2017.09.14
- Netty自娱自乐之类Dubbo RPC 框架设计构想 【上篇】
- cobbler无人值守自动安装(centos7,Redhat6)
- python 安装MySQLdb
- Python笔记_函数
- Lua 函数
- python 统计图中文乱码
- imageLoder
- L2-017. 人以群分