sanirom是什么意思思

在线翻译_在线词典_金山词霸_爱词霸英语
(window.slotbydup = window.slotbydup || []).push({
id: '2697813',
container: s,
size: '960,48',
display: 'inlay-fix'
{{item1.part | parts}}
复数: 过去式: 过去分词: 现在分词: 第三人称单数:
一键安装桌面版,查词翻译快三倍
选择要添加的生词本
Usage Note用法说明
词霸Android版
牛津词典免费使用! 立刻扫码下载
牛津词典免费使用! 立刻扫码下载
繁体笔画造字法
首部五笔结构
创建新的生词本
i该生词本已经创建啦! i不可以出现中文,英文,数字之外的符号哒! i生词本名称长度不能大于24字符! i请填写生词本名称!11635人阅读
Android——UI学习(7)
(啊,一不小心把这篇文章删了,没有备份,只能重来了。)
在API Demo的View-&Animation下可以找到四个Animation的Demo,第一个3D Translate比较复杂,最后再讲,先讲第2个Interpolator。该Activity对应的是view包内的Animation3.java,和layout的animation_3.xml。
界面的布局不加解释了,就一个Spinner和一个TextView。不是本文内容。
主要解释下几个重点语句。
初始化Animation,从类的名字可以看出是一个变换View的位置的动画,参数起点横坐标,终点横坐标,起点纵坐标,终点纵坐标。
&textarea cols=&50& rows=&15& name=&code& class=&java&&Animation a = new TranslateAnimation(0.0f,
targetParent.getWidth() - target.getWidth() - targetParent.getPaddingLeft() -
targetParent.getPaddingRight(), 0.0f, 0.0f);&/textarea&&
下面是动画的参数设置,我加上了注释
&textarea cols=&50& rows=&15& name=&code& class=&java&&a.setDuration(1000);//设置动画所用的时间
a.setStartOffset(300);//设置动画启动的延时
//设置重复模式,RESTART为结束后重新开始,REVERSE为按原来的轨迹逆向返回
a.setRepeatMode(Animation.RESTART);
//设置重复次数,INFINITE为无限
a.setRepeatCount(Animation.INFINITE);
//根据用户在Spinner的选择设置target的进入的方式
switch (position) {
//加速进入
a.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.anim.accelerate_interpolator));
//减速进入
a.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.anim.decelerate_interpolator));
//加速进入.与第一个的区别为当repeatMode为reverse时,仍为加速返回原点
a.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.anim.accelerate_decelerate_interpolator));
//先往后退一点再加速前进
a.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.anim.anticipate_interpolator));
//减速前进,冲过终点前再后退
a.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.anim.overshoot_interpolator));
//case 3,4的结合体
a.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.anim.anticipate_overshoot_interpolator));
//停止前来回振几下
a.setInterpolator(AnimationUtils.loadInterpolator(this,
android.R.anim.bounce_interpolator));
//让target开始执行这个动画
target.startAnimation(a);
}&/textarea&
这里使用的是Android已预设的一些动作,我们也可以自定义XML来实现更好看的动画效果的,这个下一篇再讲。
除了TranslationAnimation,还有AlphaAnimation、RotateAnimation、ScaleAnimation,使用这几个基体动作的组合,可以形成一系列复杂的动画效果。具体用法请查看SDK。
整个都比较简单,就一个函数的调用,还不懂的看一下API的注释和SDK文档,没什么难理解的。
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:57648次
排名:千里之外
评论:11条64859人阅读
Android(97)
第一步:先上图片素材,以下素材放到res/drawable目录下:
图片素材:
文件名称:
第二步:上动画Animation-list帧布局文件,有2个,一个是按顺序显示动画,一个是倒序显示动画,文件存放在res/drawable目录下
顺序显示动画文件:animation1.xml
&?xml version=&1.0& encoding=&utf-8&?&
根标签为animation-list,其中oneshot代表着是否只展示一遍,设置为false会不停的循环播放动画
根标签下,通过item标签对动画中的每一个图片进行声明
android:duration 表示展示所用的该图片的时间长度
&animation-list
xmlns:android=&/apk/res/android&
android:oneshot=&true&
&item android:drawable=&@drawable/icon1& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon2& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon3& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon4& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon5& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon6& android:duration=&150&&&/item&
&/animation-list&
倒序显示动画文件:animation2.xml
&?xml version=&1.0& encoding=&utf-8&?&
根标签为animation-list,其中oneshot代表着是否只展示一遍,设置为false会不停的循环播放动画
根标签下,通过item标签对动画中的每一个图片进行声明
android:duration 表示展示所用的该图片的时间长度
&animation-list
xmlns:android=&/apk/res/android&
android:oneshot=&true&
&item android:drawable=&@drawable/icon6& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon5& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon4& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon3& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon2& android:duration=&150&&&/item&
&item android:drawable=&@drawable/icon1& android:duration=&150&&&/item&
&/animation-list&
第三步:上布局文件,放在res/layout目录下,文件名main.xml:
&?xml version=&1.0& encoding=&utf-8&?&
&LinearLayout xmlns:android=&/apk/res/android&
android:layout_width=&fill_parent&
android:layout_height=&fill_parent&
android:orientation=&vertical&&
&ImageView android:id=&@+id/animationIV&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:padding=&5px&
android:src=&@drawable/animation1&/&
&Button android:id=&@+id/buttonA&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:padding=&5px&
android:text=&顺序显示& /&
&Button android:id=&@+id/buttonB&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:padding=&5px&
android:text=&停止& /&
&Button android:id=&@+id/buttonC&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:padding=&5px&
android:text=&倒序显示& /&
&/LinearLayout&
第四步:上Activity文件,文件名:MainActivity.java
package org.shuxiang.
import android.app.A
import android.graphics.drawable.AnimationD
import android.os.B
import android.view.V
import android.view.View.OnClickL
import android.view.W
import android.widget.B
import android.widget.ImageV
public class Activity10 extends Activity
private ImageView animationIV;
private Button buttonA, buttonB, buttonC;
private AnimationDrawable animationD
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.test10);
animationIV = (ImageView) findViewById(R.id.animationIV);
buttonA = (Button) findViewById(R.id.buttonA);
buttonB = (Button) findViewById(R.id.buttonB);
buttonC = (Button) findViewById(R.id.buttonC);
buttonA.setOnClickListener(new OnClickListener()
public void onClick(View v) {
// TODO Auto-generated method stub
animationIV.setImageResource(R.drawable.animation1);
animationDrawable = (AnimationDrawable) animationIV.getDrawable();
animationDrawable.start();
buttonB.setOnClickListener(new OnClickListener()
public void onClick(View v) {
// TODO Auto-generated method stub
animationDrawable = (AnimationDrawable) animationIV.getDrawable();
animationDrawable.stop();
buttonC.setOnClickListener(new OnClickListener()
public void onClick(View v) {
// TODO Auto-generated method stub
animationIV.setImageResource(R.drawable.animation2);
animationDrawable = (AnimationDrawable) animationIV.getDrawable();
animationDrawable.start();
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:2580094次
积分:12712
积分:12712
排名:第663名
原创:97篇
转载:91篇
评论:217条
(1)(1)(1)(1)(1)(4)(1)(1)(1)(2)(1)(1)(3)(1)(10)(8)(2)(1)(1)(1)(1)(1)(2)(3)(2)(68)(30)(24)(37)(2)}

我要回帖

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信