BeanMatrixImageDemoActivity.java
package beanmatrix.image.demo;
import android.view.View;
import android.widget.Toast;
public class BeanMatrixImageDemoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onClickImg(View view)
{
Toast.makeText(this, "You clicked me!", Toast.LENGTH_SHORT).show();
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/myimg"
android:clickable="true"
android:onClick="onClickImg"
/>
</LinearLayout>
package beanmatrix.image.demo;
import
android.app.Activity;
import android.os.Bundle;import android.view.View;
import android.widget.Toast;
public class BeanMatrixImageDemoActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
public void onClickImg(View view)
{
Toast.makeText(this, "You clicked me!", Toast.LENGTH_SHORT).show();
}
}
main.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/myimg"
android:clickable="true"
android:onClick="onClickImg"
/>
</LinearLayout>
No comments:
Post a Comment