android该怎么办iphone那种画面抖动的动画效果(含有button和EditText)
首先在效果图:
要做到抖动效果按钮,能够这样做。设定anim房源res以下。创建一个button_shake.xml
<? xml version="1.0" encoding="utf-8"?>
<rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="120"
android:fromDegrees="-3"
android:pivotX="100%"
android:pivotY="100%"
android:repeatCount="infinite"
android:repeatMode="reverse"
android:toDegrees="3" />
在代码里载入:
final ImageButton button = (ImageButton) findViewById(R.id.btn);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Animation shake = AnimationUtils.loadAnimation(AnimationTest.this, R.anim.button_shake);
shake.reset();
shake.setFillAfter(true);
button.startAnimation(shake);
}
});
给EditText做一个横向抖动的效果:
这样写anim的文件:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0"
android:toXDelta="10"
android:duration="1300"
android:interpolator="@anim/cycle" />
cycle.xml主要描写叙述动画的加速器:
<? xml version="1.0" encoding="utf-8"?>
<!-- 动画从開始到结束,变化率是循环给定次数的正弦曲线。
-->
<cycleInterpolator xmlns:android="http://schemas.android.com/apk/res/android"
android:cycles="20" />
代码能够这样载入:
final Button confirm = (Button) findViewById(R.id.btn_confirm);
confirm.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(custom_edittext.getText().toString().equals("jake")){
Toast.makeText(AnimationTest.this, "welcome", Toast.LENGTH_LONG).show();
}else{
Animation shake = AnimationUtils.loadAnimation(AnimationTest.this, R.anim.shake_x);
custom_edittext.startAnimation(shake);
}
}
});
怎样给ListView加一个文字先后进入的动画:
<ListView
android:id="@android:id/list"
android:persistentDrawingCache="animation|scrolling"
android:layout_width="match_parent"
android:layout_height="match_parent"
<span style="background-color: rgb(0, 153, 0);">android:layoutAnimation="@anim/layout_bottom_to_top_slide"</span> />
<layoutAnimation xmlns:android="http://schemas.android.com/apk/res/android"
android:delay="30%"
android:animation="@anim/slide_right" /> <set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator">
<translate android:fromXDelta="-100%p" android:toXDelta="0"
android:duration="@android:integer/config_shortAnimTime" />
</set>
代码能够在http://download.csdn.net/detail/baidu_nod/7616277下载
版权声明:本文博客原创文章。博客,未经同意,不得转载。
android该怎么办iphone那种画面抖动的动画效果(含有button和EditText)的更多相关文章
- Android自定义View 画弧形,文字,并增加动画效果
一个简单的Android自定义View的demo,画弧形,文字,开启一个多线程更新ui界面,在子线程更新ui是不允许的,但是View提供了方法,让我们来了解下吧. 1.封装一个抽象的View类 B ...
- Android仿QQ窗口的抖动的动画效果
就是仿照QQ窗口的抖动效果,在项目的res下创建anim文件夹,再创建两个xml文件:cycle.xml . myanim.xml cycle.xml : <?xml version ...
- Android开发UI之给ListView设置布局动画效果
1.通过JAVA代码添加,资源文件基本上不修改 XML文件,只添加了一个ListView,就不贴XML文件的代码了. java代码: public class MainActivity extends ...
- Android应用系列:仿MIUI的Toast动画效果实现(有图有源码)
前言 相信有些人用过MIUI,会发现小米的Toast跟Android传统的Toast特么是不一样的,他会从底部向上飞入,然后渐变消失.看起来效果是挺不错的,但是对于Android原生Toast是不支持 ...
- Android笔记之为自定义对话框添加移动动画效果
给底部的对话框添加移动动画效果 可通过Window.setWindowAnimations(int resId)设置 SharingDialog.java package com.bu_ish.sha ...
- Android应用系列:仿MIUI的Toast动画效果实现
前言 相信有些人用过MIUI,会发现小米的Toast跟Android传统的Toast特么是不一样的,他会从底部向上飞入,然后渐变消失.看起来效果是挺不错的,但是对于Android原生Toast是不支持 ...
- Android成长日记-使用ViewFlipper实现屏幕切换动画效果
(一) ViewFlipper介绍 Android系统自带的一个多页面管理控件,它可以实现子界面的自动切换 (二) 为ViewFlipper加入View 1. 静态导入:在Layout布局文件中直接导 ...
- android view控件的显示和隐藏动画效果
// 显示动画 mShowAction = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO ...
- Android 百度地图2.4.2版本标注动画效果
ImageView latestMapEventImageView = null; // 更新震中位置 private void updateMapEventOverlay() { mMapEvent ...
随机推荐
- Swift - 警告提示框(UIAlertController)的用法
import UIKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoa ...
- angular自定义指令相关知识及代码
原文地址 https://www.jianshu.com/p/0c015862156d 大纲 1.自定义指令之——属性指令 2.自定义属性指令的运行原理 3.自定义属性指令代码实践 4.自定义结构指令 ...
- 【35.02%】【codeforces 734A】Vladik and flights
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- cocos2d-html5 javascript 通过C++绑定,调用java方法
1.java中的写法 /* * XConnectPlugin.java * * Created on: 2014年4月30日 * Author: lswdonald9@gmail.com */ pac ...
- 【54.08%】【BZOJ 1941】Hide and Seek
Time Limit: 16 Sec Memory Limit: 162 MB Submit: 919 Solved: 497 [Submit][Status][Discuss] Descript ...
- AE指定字段转成注记
转自原文 ae指定字段转成注记 ArcMap中有一个功能是Label Features,就是可以将图层内指定字段值显示以Label形式显示在主窗口上,在Label Features后,用右键点击图层, ...
- <Linux> Xen虚拟机镜像的安装
了解系统安装在哪个磁盘上:fdisk -l 建立存放虚拟机镜像的目录:mkdir /mnt/vmx 更改文件系统格式: mkfs -t ext4 /dev/sda或者/dev/sdb(系统不在的那个硬 ...
- 数据库使用truncate清理非常多表时碰到外键约束时怎么高速解决
问题处理思路: 1. 先将数据库中涉及到外键约束的表置为无效状态 2.待清除全然部表数据后再将外键约束的表置为可用状态 详细实现脚本: declare begin for vv_sql in (SEL ...
- [Angular] Working with FormArray
'FormArray' can work with array of 'FormGroup' or 'FormControl'. form = new FormGroup({ stock: new F ...
- [Ramda] Create a Query String from an Object using Ramda's toPairs function
In this lesson, we'll use Ramda's toPairs function, along with map, join, concatand compose to creat ...