<?xml version= "1.0" encoding= "Utf-8"?>
<linearlayout xmlns:android= "Http://schemas.android.com/apk/res/android"
android:orientation= "vertical" android:layout_width= "match_parent"
android:layout_height= "Match_parent" >
<imageview
Android:id= "@+id/image_view"
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:src= "@drawable/ic_launcher"/>
<button
Android:layout_width= "Wrap_content"
android:layout_height= "Wrap_content"
android:text= "Confirm"
android:layout_gravity= "Center"/>
</LinearLayout>
Package com.example.uiwidgettest2;
Import android.app.Activity;
Import Android.os.Bundle;
Import Android.view.View;
Import android.widget.*;
public class Edittextactivity extends Activity implements view.onclicklistener{
Private ImageView IV;
Private Button btn;
@Override
protected void OnCreate (Bundle savedinstancestate) {
Super.oncreate (savedinstancestate);
Setcontentview (R.layout.edittext);
BTN = (Button) Findviewbyid (R.id.button);
IV = (ImageView) Findviewbyid (R.id.image_view);
Btn.setonclicklistener (this);
}
@Override
public void OnClick (View v) {
Switch (V.getid ()) {
Case R.id.button:
Iv.setimageresource (R.DRAWABLE.DST);
Break
Default
Break
}
}
}
Android control, EditText app