package app.test;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
public class Test extends Activity{
private ImageView one = null;
private ImageView two = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
one = (ImageView)findViewById(R.id.oneImgView);
two = (ImageView)findViewById(R.id.twoImgView);
one.setOnClickListener(new OnClickListener(){
public void onClick(View view) {
two.setVisibility(View.VISIBLE);
view.setVisibility(View.GONE);
}});
two.setOnClickListener(new OnClickListener(){
public void onClick(View view) {
one.setVisibility(View.VISIBLE);
view.setVisibility(View.GONE);
}});
}
}
//main.xml
android:id="@+id/frmLayout"
android:layout_width="fill_parent" android:layout_height="fill_parent">
android:id="@+id/oneImgView" android:src="@drawable/icon"
android:scaleType="fitCenter"
android:layout_width="fill_parent" android:layout_height="fill_parent"/>
android:id="@+id/twoImgView" android:src="@drawable/icon"
android:scaleType="fitCenter"
android:layout_width="fill_parent" android:layout_height="fill_parent"
android:visibility="gone" />