Android Activity 之间切换的各种效果
01 | <? xml version = "1.0" encoding = "utf-8" ?> |
02 | < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" |
03 | android:orientation = "vertical" android:layout_width = "fill_parent" |
04 | android:layout_height = "wrap_content" android:id = "@+id/contactItems" |
05 | android:paddingBottom = "5dip" android:paddingLeft = "12dip" |
06 | android:paddingTop = "5dip" android:paddingRight = "12dip" > |
07 | < Spinner android:layout_height = "wrap_content" |
08 | android:layout_width = "fill_parent" android:id = "@+id/sprAnim" ></ Spinner > |
09 | < Button android:layout_height = "wrap_content" |
10 | android:layout_width = "fill_parent" android:id = "@+id/btn_next" |
11 | android:text = "@string/next" ></ Button > |
01 | <? xml version = "1.0" encoding = "utf-8" ?> |
02 | < LinearLayout xmlns:android = "http://schemas.android.com/apk/res/android" |
03 | android:orientation = "vertical" android:layout_width = "fill_parent" |
04 | android:layout_height = "wrap_content" android:id = "@+id/contactItems" |
05 | android:paddingBottom = "5dip" android:paddingLeft = "12dip" |
06 | android:paddingTop = "5dip" android:paddingRight = "12dip" > |
07 | < TextView android:layout_height = "wrap_content" |
08 | android:layout_width = "fill_parent" android:id = "@+id/text2" |
09 | android:textSize = "20dip" android:paddingTop = "12px" android:text = "@string/text2" |
10 | android:layout_marginLeft = "70px" > |
12 | < EditText android:layout_height = "wrap_content" |
13 | android:layout_width = "fill_parent" ></ EditText > |
1 | <? xml version = "1.0" encoding = "utf-8" ?> |
3 | < string name = "app_name" >丸子联系人</ string > |
4 | < string name = "contact_title" >丸子联系人</ string > |
6 | < string name = "text1" >IAIAI 测试</ string > |
7 | < string name = "text2" >测试跳转效果</ string > |
8 | < string name = "next" >下一页</ string > |
01 | <? xml version = "1.0" encoding = "utf-8" ?> |
03 | < string-array name = "anim_type" > |
08 | < item >左上角展开淡出效果</ item > |
01 | package com.iaiai.activity; |
03 | import java.util.ArrayList; |
06 | import android.app.Activity; |
07 | import android.content.Intent; |
08 | import android.os.Bundle; |
09 | import android.view.View; |
10 | import android.view.View.OnClickListener; |
11 | import android.widget.ArrayAdapter; |
12 | import android.widget.Button; |
13 | import android.widget.Spinner; |
15 | public class IaiaiActivity extends Activity { |
18 | protected void onCreate(Bundle savedInstanceState) { |
19 | super .onCreate(savedInstanceState); |
20 | setContentView(R.layout.main); |
22 | final Spinner sprAnim = (Spinner) findViewById(R.id.sprAnim); |
24 | String[] ls = getResources().getStringArray(R.array.anim_type); |
25 | List<String> list = new ArrayList<String>(); |
27 | for ( int i = 0 ; i < ls.length; i++) { |
30 | ArrayAdapter<String> animType = new ArrayAdapter<String>( this , |
31 | android.R.layout.simple_spinner_item, list); |
32 | animType.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); |
33 | sprAnim.setAdapter(animType); |
34 | sprAnim.setSelection( 0 ); |
36 | Button btn = (Button) findViewById(R.id.btn_next); |
37 | btn.setOnClickListener( new OnClickListener() { |
39 | public void onClick(View v) { |
40 | Intent it = new Intent(IaiaiActivity. this , NextActivity. class ); |
41 | startActivityForResult(it, 0 ); |
43 | switch (sprAnim.getSelectedItemPosition()) { |
45 | overridePendingTransition(R.anim.fade, R.anim.hold); |
48 | overridePendingTransition(R.anim.my_scale_action, |
49 | R.anim.my_alpha_action); |
52 | overridePendingTransition(R.anim.scale_rotate, |
53 | R.anim.my_alpha_action); |
56 | overridePendingTransition(R.anim.scale_translate_rotate, |
57 | R.anim.my_alpha_action); |
60 | overridePendingTransition(R.anim.scale_translate, |
61 | R.anim.my_alpha_action); |
64 | overridePendingTransition(R.anim.hyperspace_in, |
65 | R.anim.hyperspace_out); |
68 | overridePendingTransition(R.anim.push_left_in, |
69 | R.anim.push_left_out); |
72 | overridePendingTransition(R.anim.push_up_in, |
76 | overridePendingTransition(R.anim.slide_left, |
80 | overridePendingTransition(R.anim.wave_scale, |
81 | R.anim.my_alpha_action); |
84 | overridePendingTransition(R.anim.zoom_enter, |
88 | overridePendingTransition(R.anim.slide_up_in, |
89 | R.anim.slide_down_out); |
01 | package com.iaiai.activity; |
03 | import android.app.Activity; |
04 | import android.content.Intent; |
05 | import android.os.Bundle; |
06 | import android.view.KeyEvent; |
08 | public class NextActivity extends Activity { |
11 | protected void onCreate(Bundle savedInstanceState) { |
12 | super .onCreate(savedInstanceState); |
13 | setContentView(R.layout.next); |
16 | public boolean onKeyDown( int keyCode, KeyEvent event) { |
17 | if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 ) { |
18 | Intent intent = new Intent(NextActivity. this , IaiaiActivity. class ); |
19 | setResult(RESULT_OK, intent); |
21 | overridePendingTransition(R.anim.slide_up_in, R.anim.slide_down_out); |
01 | package com.iaiai.activity; |
03 | import android.app.Activity; |
04 | import android.content.Intent; |
05 | import android.os.Bundle; |
06 | import android.view.KeyEvent; |
08 | public class NextActivity extends Activity { |
11 | protected void onCreate(Bundle savedInstanceState) { |
12 | super .onCreate(savedInstanceState); |
13 | setContentView(R.layout.next); |
16 | public boolean onKeyDown( int keyCode, KeyEvent event) { |
17 | if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0 ) { |
18 | Intent intent = new Intent(NextActivity. this , IaiaiActivity. class ); |
19 | setResult(RESULT_OK, intent); |
21 | overridePendingTransition(R.anim.slide_up_in, R.anim.slide_down_out); |
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请
点击举报。