基本信息
源码名称:基于安卓的图片浏览器 示例源码
源码大小:2.93M
文件格式:.zip
开发语言:Java
更新时间:2017-11-29
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
package com.explam.YN; import com.explam.YN.R; import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.view.animation.RotateAnimation; import android.view.animation.ScaleAnimation; import android.view.animation.TranslateAnimation; import android.widget.*; import android.widget.AdapterView.OnItemClickListener; import android.util.DisplayMetrics; public class testGallery extends Activity { private Gallery myGallery; private Animation myAnimationAlpha; private Animation myAnimationScale; private Animation myAnimationTranslate; private Animation myAnimationRotate; private int i=0; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); myGallery=(Gallery)findViewById(R.id.Gallery01); DisplayMetrics dm=new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); myGallery.setAdapter(new ImageAdapter(this,dm.heightPixels,dm.widthPixels)); myAnimationAlpha=new AlphaAnimation(0.1f, 1.0f); myAnimationAlpha.setDuration(3000); myAnimationScale=new ScaleAnimation(0.0f, 1.4f, 0.0f, 1.4f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f); myAnimationScale.setDuration(3000); myAnimationTranslate=new TranslateAnimation(30.0f, -80.0f, 30.0f, 300.0f); myAnimationTranslate.setDuration(3000); myAnimationRotate=new RotateAnimation(0.0f, 350.0f, Animation.RELATIVE_TO_SELF,0.5f,Animation.RELATIVE_TO_SELF, 0.5f); myAnimationRotate.setDuration(3000); // myAnimationTranslate= myGallery.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { ImageView ig=(ImageView)arg1; switch (i) { case 0: ig.startAnimation(myAnimationAlpha); i ; break; case 1: ig.startAnimation(myAnimationScale); i ; break; case 2: ig.startAnimation(myAnimationTranslate); i ; break; case 3: ig.startAnimation(myAnimationRotate); i=0; break; default: break; } //ImageAdapter.myImageArray[arg2]; } }); } }