Did you try with a gallery and a image view ?
<RelativeLayout>
<ImageView android:id="@+id/BigView" android:layout_width="XXdip" android:layout_height="XXdip" android:scaleType="fitCenter" />
<Gallery android:id="@+id/MyGallery" android:unselectedAlpha="0.5" android:layout_below="@id/BigView" android:layout_height="XXdip" />
</RelativeLayout>
You have to specify a height to your gallery. And you add a OnItemSelectedListener.
final int[] p = {R.drawable.img1, R.drawable.img2, R.drawable.img3, ...};
final ImageView i = (ImageView) findViewById(R.id.BigView);
Gallery g = (Gallery) findViewById(R.id.MyGallery);
g.setAdapter(...);
g.setOnItemSelectedListener(new OnItemSelectedListener() {
public void onItemSelected (AdapterView<?> parent, View view, int position, long id) {
i.setImageResource(p[position]);
// Maybe you can try
// i.setImageDrawable(((ImageView) view).getDrawable());
}
});
With the scaleType fitCenter your image will be fit to the ImageView size kepping the aspect ratio.
So set directly the big size.
Otherwise you can add an ImageView in the RelativeLayout in fill_parent both layout size and set the visibility to gone, add :
i.setOnClickListener(new OnClickLisyener() {
MyHiddenImageView.setImageResource(p[g.getSelectedItemPosition()]);
MyHiddenImageView.setVisibility(View.VISIBLE);
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…