Android:ZoomControls控件

ZoomControls控件

//_ZoomControls.java
public class _ZoomControls extends Activity{
    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        this.setContentView(R.layout.zoomcontrols);
        setTitle("ZoomControls");       
        ZoomControls zoomControls=(ZoomControls)findViewById(R.id.zoomControls);
        //响应单击放大按钮的事件
        zoomControls.setOnZoomInClickListener(new OnClickListener(){
            public void onClick(View v){
                Toast.makeText(_ZoomControls.this, "单击了放大按钮", Toast.LENGTH_SHORT).show();    
            }
        });
        //响应单击缩小按钮的事件
        zoomControls.setOnZoomOutClickListener(new OnClickListener() {
            public void onClick(View v) {
                Toast.makeText(_ZoomControls.this, "单击了缩小按钮", Toast.LENGTH_SHORT).show(); 
            }
        });
    }
}
"1.0" encoding="utf-8"?>
"http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:layout_height="fill_parent"
    android:orientation="vertical" >
  
    <ZoomControls 
        android:id="@+id/zoomControls"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"> 

 

 

 

参考链接:

代码下载链接:

你可能感兴趣的:(Android:ZoomControls控件)