-
-
-
method:ScrollView ( Context context )
return type:ScrollView
content:ใช้สร้าง Object ScrollView
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
setContentView ( scroll_view );
}
}
-
method:addView ( View child, int index )
return type:void
content:ใช้เพิ่ม view เข้าไปใน Object ScrollView ณ ตำแหน่งที่กำหนด
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
scroll_view.addView ( button, 0 );
setContentView ( scroll_view );
}
}
-
method:addView ( View child )
return type:void
content:ใช้เพิ่ม view เข้าไปใน Object ScrollView
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
scroll_view.addView ( button );
setContentView ( scroll_view );
}
}
-
method:addView ( View child, ViewGroup.LayoutParams params )
return type:void
content:ใช้เพิ่ม view เข้าไปใน Object ScrollView
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, params );
setContentView ( scroll_view );
}
}
-
method:addView ( View child, int index, ViewGroup.LayoutParams params )
return type:void
content:ใช้เพิ่ม view เข้าไปใน Object ScrollView ณ ตำแหน่งที่กำหนด
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
setContentView ( scroll_view );
}
}
-
method:getMaxScrollAmount ( )
return type:int
content:ใช้คืนค่า จำนวนสูงสุด ของ การ scroll ของ Object ScrollView
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
int max_scroll = scroll_view.getMaxScrollAmount ( );
setContentView ( scroll_view );
}
}
-
method:isFillViewport ( )
return type:boolean
content:ใช้ตรวจสอบว่าได้กำหนดให้ใช้แบบ Fill Viewport หรือไม่
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
if ( scroll_view.isFillViewport ( ) )
{
Toast.makeText ( this, "ScrollView use fill viewport.", Toast.LENGTH_SHORT ).show ( );
}
setContentView ( scroll_view );
}
}
-
method:isSmoothScrollingEnabled ( )
return type:boolean
content:ใช้ตรวจสอบว่า ได้เปิดใช้ smooth scroll หรือไม่
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
if ( scroll_view.isSmoothScrollingEnabled ( ) )
{
Toast.makeText ( this, "ScrollView use smooth scroll.", Toast.LENGTH_SHORT ).show ( );
}
setContentView ( scroll_view );
}
}
-
method:scrollTo ( int x, int y )
return type:void
content:ใช้เลื่อน scroll ไปยังตำแหน่ง x, y ที่กำหนด
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
scroll_view.scrollTo ( 0, 50 );
setContentView ( scroll_view );
}
}
-
method:setFillViewport ( boolean fillViewport )
return type:void
content:ใช้กำหนดว่า จะใช้ fill viewport หรือไม่
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
scroll_view.setFillViewport ( true );
setContentView ( scroll_view );
}
}
-
method:setSmoothScrollingEnabled ( boolean smoothScrollingEnabled )
return type:void
content:ใช้กำหนดว่า จะใช้ smooth scroll หรือไม่
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
scroll_view.setSmoothScrollingEnabled ( true );
setContentView ( scroll_view );
}
}
-
method:smoothScrollBy ( int dx, int dy )
return type:void
content:ใช้เลื่อน scroll แบบ smooth โดยจะเลื่อนเพิ่มไปตามจำนวนที่กำหนด
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
scroll_view.setSmoothScrollingEnabled ( true );
scroll_view.smoothScrollBy ( 0, 30 );
setContentView ( scroll_view );
}
}
-
method:smoothScrollTo ( int x, int y )
return type:void
content:ใช้เลื่อน scroll แบบ smooth โดยจะเลื่อนไปยังตำแหน่ง x, y ที่กำหนด
example:public class AndroidBamboo extends Activity
{
public void onCreate( Bundle savedInstanceState )
{
super.onCreate ( savedInstanceState );
ScrollView scroll_view = new ScrollView ( this );
Button button = new Button ( this );
button.setText ( "Into BambooLabCode" );
ViewGroup.LayoutParams params = new ViewGroup.LayoutParams ( 100, 24 );
scroll_view.addView ( button, 0, params );
scroll_view.setSmoothScrollingEnabled ( true );
scroll_view.smoothScrollTo ( 0, 30 );
setContentView ( scroll_view );
}
}
-
method:onTouchEvent ( MotionEvent event )
return type:boolean
content:เป็น method ที่ใช้สำหรับการ overridde โดย method นี้จะถูกเรียกใช้เมื่อ
มีการสัมผัสที่ Object ScrollView
example:public class BambooView extends ScrollView
{
public boolean onTouchEvent ( MotionEvent event )
{
return false;
}
}
-
method:onSizeChanged ( int w, int h, int oldw, int oldh )
return type:void
content:เป็น method ที่ใช้สำหรับการ overridde โดย method นี้จะถูกเรียกใช้เมื่อ
Object ScrollView ถูกเปลี่ยนแปลง ขนาด
example:public class BambooView extends ScrollView
{
protected void onSizeChanged ( int w, int h, int oldw, int oldh )
{
}
}