当前位置: 编程技术>移动开发
本页文章导读:
▪Gallery 组件相干 Gallery 组件相关
Android gallery实现图片的左右循环旋转源码分享
使用Android自带Gallery组件实现CoverFlow,源码+解析
Android的gallery实现无限循环和降低选择频率
可循环显示图像的Gallery组.........
▪ Activity其间切换的各种效果(遗憾没有3D的效果)Activity之间切换的各种效果(遗憾没有3D的效果) Activity之间切换的各种效果(遗憾没有3D的效果)Activity之间切换的各种效果(遗憾没有3D的效果)
下面的Demo是我找到的一个觉得用来在程序中进行Activity之间切换的很好的一个例子:
package com.asai.a.........
▪ 怎么让你的list不被修改 如何让你的list不被修改
今天在看QuickSearchBox的源码:发现了可以对list的限制,不让list被修改: private List<Corpus> mEnabledCorpora;
mEnabledCorpora = Collections.unmodifiableList(mEnabledCorpora);官方文档.........
[1]Gallery 组件相干
来源: 互联网 发布时间: 2014-02-18
Gallery 组件相关
Android gallery实现图片的左右循环旋转源码分享
使用Android自带Gallery组件实现CoverFlow,源码+解析
Android gallery实现图片的左右循环旋转源码分享
使用Android自带Gallery组件实现CoverFlow,源码+解析
Android的gallery实现无限循环和降低选择频率
可循环显示图像的Gallery组件
镜像倒影特效Gallery
用GridView实现Gallery的效果
[2] Activity其间切换的各种效果(遗憾没有3D的效果)Activity之间切换的各种效果(遗憾没有3D的效果)
来源: 互联网 发布时间: 2014-02-18
Activity之间切换的各种效果(遗憾没有3D的效果)Activity之间切换的各种效果(遗憾没有3D的效果)
package com.asai.android.demo;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
public class demoMain extends Activity {
private Button btnDemo;
private Spinner sprAnim;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
btnDemo = (Button) findViewById(R.id.btnDemo);
sprAnim = (Spinner) findViewById(R.id.sprAnim);
//Spinner的内容适配器
ArrayAdapter<?> animType = ArrayAdapter.createFromResource(this,
R.array.anim_type, android.R.layout.simple_spinner_item);
animType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
sprAnim.setAdapter(animType);
//默认选中第一项
sprAnim.setSelection(0);
btnDemo.setOnClickListener(new View.OnClickListener() {
public void onClick(View view) {
startActivity(new Intent(demoMain.this, demoDetail.class));
switch (sprAnim.getSelectedItemPosition()) {
case 1:
//淡入淡出效果
overridePendingTransition(R.anim.fade, R.anim.hold);
break;
case 2:
overridePendingTransition(R.anim.alpha_rotate,
R.anim.my_alpha_action);
break;
case 3:
overridePendingTransition(R.anim.alpha_scale_rotate,
R.anim.my_alpha_action);
break;
case 4:
overridePendingTransition(
R.anim.alpha_scale_translate_rotate,
R.anim.my_alpha_action);
break;
case 5:
overridePendingTransition(R.anim.alpha_scale_translate,
R.anim.my_alpha_action);
break;
case 6:
//中心放大效果
overridePendingTransition(R.anim.alpha_scale,
R.anim.my_alpha_action);
break;
case 7:
overridePendingTransition(R.anim.alpha_translate_rotate,
R.anim.my_alpha_action);
break;
case 8:
overridePendingTransition(R.anim.alpha_translate,
R.anim.my_alpha_action);
break;
case 9:
overridePendingTransition(R.anim.my_rotate_action,
R.anim.my_alpha_action);
break;
case 10:
overridePendingTransition(R.anim.my_scale_action,
R.anim.my_alpha_action);
break;
case 11:
overridePendingTransition(R.anim.my_translate_action,
R.anim.my_alpha_action);
break;
case 12:
overridePendingTransition(R.anim.myanimation_simple,
R.anim.my_alpha_action);
break;
case 13:
overridePendingTransition(R.anim.myown_design,
R.anim.my_alpha_action);
break;
case 14:
overridePendingTransition(R.anim.scale_rotate,
R.anim.my_alpha_action);
break;
case 15:
overridePendingTransition(R.anim.scale_translate_rotate,
R.anim.my_alpha_action);
break;
case 16:
overridePendingTransition(R.anim.scale_translate,
R.anim.my_alpha_action);
break;
case 17:
overridePendingTransition(R.anim.translate_rotate,
R.anim.my_alpha_action);
break;
case 18:
overridePendingTransition(R.anim.hyperspace_in,
R.anim.hyperspace_out);
break;
case 19:
overridePendingTransition(R.anim.shake,
R.anim.my_alpha_action);
break;
case 20:
overridePendingTransition(R.anim.push_left_in,
R.anim.push_left_out);
break;
case 21:
//从下方移出效果 overridePendingTransition(R.anim.push_up_in,
R.anim.push_up_out);
break;
case 22:
overridePendingTransition(R.anim.slide_left,
R.anim.slide_right);
break;
case 23:
overridePendingTransition(R.anim.slide_top_to_bottom,
R.anim.my_alpha_action);
break;
case 24:
overridePendingTransition(R.anim.wave_scale,
R.anim.my_alpha_action);
break;
}
}
});
}
}
复制代码
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="anim_type">
<item>zoom_enter</item>
<item>fade</item>
<item>alpha_rotate</item>
<item>alpha_scale_rotate</item>
<item>alpha_scale_translate_rotate</item>
<item>alpha_scale_translate</item>
<item>alpha_scale</item>
<item>alpha_translate_rotate</item>
<item>alpha_translate</item>
<item>my_rotate_action</item>
<item>my_scale_action</item>
<item>my_translate_action</item>
<item>myanimation_simple</item>
<item>myown_design</item>
<item>scale_rotate</item>
<item>scale_translate_rotate</item>
<item>scale_translate</item>
<item>translate_rotate</item>
<item>hyperspace_in</item>
<item>shake</item>
<item>push_left_in</item>
<item>push_up_in</item>
<item>slide_left</item>
<item>slide_top_to_bottom</item>
<item>wave_scale</item>
</string-array>
</resources>
复制代码
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="100%p" android:toYDelta="0" android:duration="300"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="300" />
</set>
复制代码
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromYDelta="0" android:toYDelta="-100%p" android:duration="300"/>
<alpha android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="300" />
</set>
复制代码
下面的Demo是我找到的一个觉得用来在程序中进行Activity之间切换的很好的一个例子:
另外一个activity可以自己随便写个,这里还用到了就是arrays.xml作为Spinner的适配器:
其实这个Demo最重要的就是anim中的一些xml动画定义:
下面我一个一个的来介绍下(我觉得实用性很好的):
push_up_in.xml:
相信这段代码我不用解释应该也看的懂:改变y坐标来实现动画效果;
相对应的就是:
push_up_out.xml:
里面实在太多了,我直接贴上附件,需要的可以自己下了学习
AnimDemo.rar
(94.29 KB, 下载次数: 697)
1 楼
亮亮婷婷
2011-09-27
下载不了啊!
[3] 怎么让你的list不被修改
来源: 互联网 发布时间: 2014-02-18
如何让你的list不被修改
今天在看QuickSearchBox的源码:发现了可以对list的限制,不让list被修改:
官方文档写:
public static List<E> unmodifiableList (List<? extends E> list)
Since: API Level 1
Returns a wrapper on the specified list which throws an UnsupportedOperationException whenever an attempt is made to modify the list.
Parameters
list the list to wrap in an unmodifiable list.
Returns
an unmodifiable List.
今天在看QuickSearchBox的源码:发现了可以对list的限制,不让list被修改:
private List<Corpus> mEnabledCorpora; mEnabledCorpora = Collections.unmodifiableList(mEnabledCorpora);
官方文档写:
public static List<E> unmodifiableList (List<? extends E> list)
Since: API Level 1
Returns a wrapper on the specified list which throws an UnsupportedOperationException whenever an attempt is made to modify the list.
Parameters
list the list to wrap in an unmodifiable list.
Returns
an unmodifiable List.
最新技术文章: