I have implemented a gallery where on touch the image is displayed at the centre of the screen
Now the image just pops up. How can i get the effect of image coming fro left or right of the screen, a sliding effect
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:id="@+id/imageView1" android:layout_width="200dip"
android:layout_height="200dip" ></ImageView>
<Gallery xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gallery" android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="0dip" android:paddingLeft="0dip"/>
</LinearLayout>
adapter code:
public View getView(int position, View convertView, ViewGroup parent) {
ImageView imageView = new ImageView(mContext);
imageView.setImageResource(mImageIds[position]);
imageView.setLayoutParams(new Gallery.LayoutParams(100, 100));
imageView.setScaleType(ImageView.ScaleType.FIT_XY);
imageView.setBackgroundResource(mGalleryItemBackground);
return imageView;
}
gallery activity :
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.gallery);
Gallery gallery = (Gallery) findViewById(R.id.gallery);
gallery.setAdapter(new ImageAdaptor(this));
gallery.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView parent, View v, int position, long id) {
ImageView image = (ImageView)
findViewById(R.id.imageView1);
image.setImageResource(mImageIds[position]);
}
});
}
Here is the solution i found
slidefromleft.xml