Android仿Iphone图标抖动效果

               

http://blog.csdn.net/long33long/article/details/7693671

最近闲来无聊,研究了一下IPhone桌面图标的抖动,网上有一个类似的事例,但是我看来效果实在不佳,自己也来写一个玩玩,当然代码很乱,杂乱无章,不满意的别骂我啊,当然也欢迎一起交流啊,嚯嚯

首先是JAVA代码ShakeTestActivity.java:

[java]  view plain copy
  1. package com.android.shake;  
  2.   
  3. import android.app.Activity;  
  4. import android.os.Bundle;  
  5. import android.util.DisplayMetrics;  
  6. import android.view.animation.Animation;  
  7. import android.view.animation.Animation.AnimationListener;  
  8. import android.view.animation.RotateAnimation;  
  9. import android.widget.TextView;  
  10. import android.view.View;  
  11. import android.view.Window;  
  12.   
  13. public class ShakeTestActivity extends Activity implements View.OnClickListener {  
  14.     private TextView mtv0;  
  15.     private TextView mtv1;  
  16.     private TextView mtv2;  
  17.     private TextView mtv3;  
  18.     private TextView mtv4;  
  19.     private TextView mtv5;  
  20.     private TextView mtv6;  
  21.     private TextView mtv7;  
  22.     private TextView mtv8;  
  23.     private TextView mtv9;  
  24.     private TextView mtv10;  
  25.     private TextView mtv11;  
  26.     private TextView mtv12;  
  27.     private TextView mtv13;  
  28.     private TextView mtv14;  
  29.     private TextView mtv15;  
  30.     private TextView mtv16;  
  31.     private TextView mtv17;  
  32.     private TextView mtv18;  
  33.     private TextView mtv19;  
  34.   
  35.     private boolean mNeedShake = false;  
  36.     private boolean mStartShake = false;  
  37.   
  38.     private static final int ICON_WIDTH = 80;  
  39.     private static final int ICON_HEIGHT = 94;  
  40.     private static final float DEGREE_0 = 1.8f;  
  41.     private static final float DEGREE_1 = -2.0f;  
  42.     private static final float DEGREE_2 = 2.0f;  
  43.     private static final float DEGREE_3 = -1.5f;  
  44.     private static final float DEGREE_4 = 1.5f;  
  45.     private static final int ANIMATION_DURATION = 80;  
  46.   
  47.     private int mCount = 0;  
  48.   
  49.     float mDensity;  
  50.   
  51.     /** Called when the activity is first created. */  
  52.     @Override  
  53.     public void onCreate(Bundle savedInstanceState) {  
  54.         super.onCreate(savedInstanceState);  
  55.         requestWindowFeature(Window.FEATURE_NO_TITLE);  
  56.         setContentView(R.layout.main);  
  57.         DisplayMetrics dm = new DisplayMetrics();  
  58.         getWindowManager().getDefaultDisplay().getMetrics(dm);  
  59.         if (dm != null) {  
  60.             mDensity = dm.density;  
  61.         }  
  62.         mtv0 = (TextView) findViewById(R.id.tv0);  
  63.         mtv0.setOnClickListener(this);  
  64.         mtv1 = (TextView) findViewById(R.id.tv1);  
  65.         mtv1.setOnClickListener(this);  
  66.         mtv2 = (TextView) findViewById(R.id.tv2);  
  67.         mtv2.setOnClickListener(this);  
  68.         mtv3 = (TextView) findViewById(R.id.tv3);  
  69.         mtv3.setOnClickListener(this);  
  70.         mtv4 = (TextView) findViewById(R.id.tv4);  
  71.         mtv4.setOnClickListener(this);  
  72.         mtv5 = (TextView) findViewById(R.id.tv5);  
  73.         mtv5.setOnClickListener(this);  
  74.         mtv6 = (TextView) findViewById(R.id.tv6);  
  75.         mtv6.setOnClickListener(this);  
  76.         mtv7 = (TextView) findViewById(R.id.tv7);  
  77.         mtv7.setOnClickListener(this);  
  78.         mtv8 = (TextView) findViewById(R.id.tv8);  
  79.         mtv8.setOnClickListener(this);  
  80.         mtv9 = (TextView) findViewById(R.id.tv9);  
  81.         mtv9.setOnClickListener(this);  
  82.         mtv10 = (TextView) findViewById(R.id.tv10);  
  83.         mtv10.setOnClickListener(this);  
  84.         mtv11 = (TextView) findViewById(R.id.tv11);  
  85.         mtv11.setOnClickListener(this);  
  86.         mtv12 = (TextView) findViewById(R.id.tv12);  
  87.         mtv12.setOnClickListener(this);  
  88.         mtv13 = (TextView) findViewById(R.id.tv13);  
  89.         mtv13.setOnClickListener(this);  
  90.         mtv14 = (TextView) findViewById(R.id.tv14);  
  91.         mtv14.setOnClickListener(this);  
  92.         mtv15 = (TextView) findViewById(R.id.tv15);  
  93.         mtv15.setOnClickListener(this);  
  94.         mtv16 = (TextView) findViewById(R.id.tv16);  
  95.         mtv16.setOnClickListener(this);  
  96.         mtv17 = (TextView) findViewById(R.id.tv17);  
  97.         mtv17.setOnClickListener(this);  
  98.         mtv18 = (TextView) findViewById(R.id.tv18);  
  99.         mtv18.setOnClickListener(this);  
  100.         mtv19 = (TextView) findViewById(R.id.tv19);  
  101.         mtv19.setOnClickListener(this);  
  102.   
  103.     }  
  104.   
  105.     @Override  
  106.     public void onClick(View v) {  
  107.   
  108.         if (!mStartShake) {  
  109.             mStartShake = true;  
  110.             mNeedShake = true;  
  111.             shakeAnimation(mtv0);  
  112.             shakeAnimation(mtv1);  
  113.             shakeAnimation(mtv2);  
  114.             shakeAnimation(mtv3);  
  115.             shakeAnimation(mtv4);  
  116.             shakeAnimation(mtv5);  
  117.             shakeAnimation(mtv6);  
  118.             shakeAnimation(mtv7);  
  119.             shakeAnimation(mtv8);  
  120.             shakeAnimation(mtv9);  
  121.             shakeAnimation(mtv10);  
  122.             shakeAnimation(mtv11);  
  123.             shakeAnimation(mtv12);  
  124.             shakeAnimation(mtv13);  
  125.             shakeAnimation(mtv14);  
  126.             shakeAnimation(mtv15);  
  127.             shakeAnimation(mtv16);  
  128.             shakeAnimation(mtv17);  
  129.             shakeAnimation(mtv18);  
  130.             shakeAnimation(mtv19);  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
仿iPhone热门应用栏是一个非常流行的产品趋势,许多手机品牌已经开始推出类似的产品。仿iPhone热门应用栏是指手机系统底部的一排常用应用图标,用户可以轻松访问和切换这些应用程序。 优点: 1. 提高用户体验:仿iPhone热门应用栏将常用的应用程序放置在屏幕底部,用户可以轻松地操作和访问这些应用。这种设计提高了用户的便利性和操作效率。 2. 提升工作效率:对于经常使用特定应用程序的用户来说,将它们放在热门应用栏中可以节省寻找和打开应用的时间,提高工作效率。 3. 可定制性:用户可以根据自己的需求和喜好,在热门应用栏中添加或删除特定的应用程序。这种可定制性使得用户可以根据自己的使用习惯进行个性化设置。 缺点: 1. 屏幕空间受限:仿iPhone热门应用栏通常会占据屏幕底部的一部分空间,可能会减少用户在其他应用程序中可见的屏幕空间。这对于一些需要较大屏幕空间才能展示内容的应用程序来说可能是一个问题。 2. 可能存在兼容性问题:由于不同手机品牌和操作系统之间存在差异,仿iPhone热门应用栏可能在某些设备上无法正常运行或显示。这需要开发人员在设计和开发过程中考虑到兼容性问题。 总结: 仿iPhone热门应用栏是一种流行的设计趋势,它提供了一种方便和高效的方式来访问和切换常用应用程序。虽然它具有许多优点,但也存在一些限制和挑战,特别是在屏幕空间和设备兼容性方面。因此,在设计和实施仿iPhone热门应用栏时,需要综合考虑这些因素,并根据特定的用户需求进行定制。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值