| ViewAnimator() | ใช้สร้าง Object ViewAnimator |
|---|---|
| addView ( child ) | ใช้เพิ่ม Object View เข้าไปใน Object ViewAnimator |
| getCurrentView() | ใช้คืนค่า view ปัจจุบันที่กำลังถูกแสดงอยู่ใน Object ViewAnimator |
| getDisplayedChild() | ใช้คืนค่า ตำแหน่งปัจจุบันของ view ที่กำลังถูกแสดงอยู่ใน Object ViewAnimator |
| removeAllViews() | ใช้ลบ view ทั้งหมดที่อยู่ใน Object ViewAnimator |
| removeView() | ใช้ลบ view ที่กำหนด ออกจาก Object ViewAnimator |
| removeViewAt() | ใช้ลบ view ณ ตำแหน่ง ที่กำหนด ออกจาก Object ViewAnimator |
| removeViews() | ใช้ลบ view ตั้งแต่ตำแหน่งที่กำหนด ถึงตำแหน่งที่กำหนด ออกจาก Object ViewAnimator |
| setDisplayedChild() | ใช้กำหนด ตำแหน่งของ view ปัจจุบัน ที่ต้องการให้แสดงบน Object ViewAnimator |
| showNext() | ใช้เลื่อน view ที่อยู่ภายใน Object ViewAnimator ไปยังตำแหน่งถัดไป |
| showPrevious() | ใช้เลื่อน view ที่อยู่ภายใน Object ViewAnimator ไปยังตำแหน่งก่อนหน้า |
method:ViewAnimator ( Context context )
return type:ViewAnimator
content:ใช้สร้าง Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); setContentView ( animator ); } }
method:addView ( View child )
return type:void
content:ใช้เพิ่ม Object View เข้าไปใน Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); setContentView ( animator ); } }
method:getCurrentView ( )
return type:View
content:ใช้คืนค่า view ปัจจุบันที่กำลังถูกแสดงอยู่ใน Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); View current_view = animator.getCurrentView ( ); setContentView ( animator ); } }
method:getDisplayedChild ( )
return type:int
content:ใช้คืนค่า ตำแหน่งปัจจุบันของ view ที่กำลังถูกแสดงอยู่ใน Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); int current_position = animator.getDisplayedChild ( ); setContentView ( animator ); } }
method:removeAllViews ( )
return type:void
content:ใช้ลบ view ทั้งหมดที่อยู่ใน Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); animator.removeAllViews ( ); setContentView ( animator ); } }
method:removeView ( View view )
return type:void
content:ใช้ลบ view ที่กำหนด ออกจาก Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); animator.removeView ( button_1 ); setContentView ( animator ); } }
method:removeViewAt ( int index )
return type:void
content:ใช้ลบ view ณ ตำแหน่ง ที่กำหนด ออกจาก Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); animator.removeViewAt ( 0 ); setContentView ( animator ); } }
method:removeViews ( int start, int count )
return type:void
content:ใช้ลบ view ตั้งแต่ตำแหน่งที่กำหนด ถึงตำแหน่งที่กำหนด ออกจาก Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); Button button_3 = new Button ( this ); button_3.setText ( "Animator 3" ); animator.addView ( button_3 ); animator.removeViews ( 0, 1 ); setContentView ( animator ); } }
method:setDisplayedChild ( int whichChild )
return type:void
content:ใช้กำหนด ตำแหน่งของ view ปัจจุบัน ที่ต้องการให้แสดงบน Object ViewAnimator
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); animator.setDisplayedChild ( 1 ); setContentView ( animator ); } }
method:showNext ( )
return type:void
content:ใช้เลื่อน view ที่อยู่ภายใน Object ViewAnimator ไปยังตำแหน่งถัดไป
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); animator.showNext ( ); setContentView ( animator ); } }
method:showPrevious ( )
return type:void
content:ใช้เลื่อน view ที่อยู่ภายใน Object ViewAnimator ไปยังตำแหน่งก่อนหน้า
example:public class AndroidBamboo extends Activity { public void onCreate( Bundle savedInstanceState ) { super.onCreate ( savedInstanceState ); ViewAnimator animator = new ViewAnimator ( this ); Button button_1 = new Button ( this ); button_1.setText ( "Animator 1" ); animator.addView ( button_1 ); Button button_2 = new Button ( this ); button_2.setText ( "Animator 2" ); animator.addView ( button_2 ); animator.showPrevious ( ); setContentView ( animator ); } }