-1

I would like to develop a brochure app in which any person can go through various photos by flicking (or scrolling) them from one photo to the other. Here is where I hit a road block. I need to know what methods I need to use (eg OnClickListener) to implement. I would also like to add extra UI capabilities (eg pinch to zoom, restrict view to landscape) could you direct me to some tutorials. If you've worked on such an app before could you tell me what problems you faced while working.

I am asking a lot in one question. Just hint me through what is important and how to handle the problems I might face.

Thank you for your input and time :)

Seshu Vinay
  • 13,560
  • 9
  • 60
  • 109
Vinoth
  • 1,339
  • 6
  • 23
  • 42
  • 2
    May be this will help you get started. http://www.androidpeople.com/android-gallery-imageview-example – kosa Jan 06 '12 at 04:55
  • thinksteep.... could you tell me what method performs the flick action from one image to another ? The example provided is good but I what I want is to change the image by sliding my finger across the screen. Is there any particular method ? – Vinoth Jan 06 '12 at 06:29

1 Answers1

1

First you implement the Gallery View from the below code as:

<?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">

    <FrameLayout android:id="@+id/frameLayout2"
        android:layout_width="fill_parent" android:layout_height="fill_parent"
        android:background="#ffffff">
        <LinearLayout android:id="@+id/LinearLayout01"
            android:layout_width="fill_parent" android:layout_height="fill_parent"
            android:orientation="vertical" android:layout_marginBottom="60dip">
            <Gallery xmlns:android="http://schemas.android.com/apk/res/android"
                android:id="@+id/examplegallery" android:layout_height="wrap_content" android:layout_width="fill_parent"/>
            <FrameLayout android:id="@+id/fr" android:layout_width="fill_parent"
            android:layout_height="150dip">
            <ImageView android:id="@+id/ImageView01"
            android:layout_gravity="center_horizontal"
                android:layout_width="200dip" android:layout_height="200dip"/></FrameLayout>
        </LinearLayout>

    </FrameLayout>

</LinearLayout>


public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.grid_greetings);
         imgView = (ImageView)findViewById(R.id.ImageView01);
         btn_capture = (Button)findViewById(R.id.btn_Grid_Capture);
         btn_preview = (Button)findViewById(R.id.btn_Grid_PreviewGreeting);
         imgView.setImageResource(Imgid[0]);
            bundle = getIntent().getExtras();
             gallery = (Gallery) findViewById(R.id.examplegallery);
             gallery.setAdapter(new AddImgAdp(this));

             gallery.setOnItemClickListener(new OnItemClickListener() {
                public void onItemClick(AdapterView parent, View v, int position, long id) {
                    imgView.setImageResource(Imgid[position]); 
                    img_position = position;
                }
            });


    }

Then Go through this link Pinching and Zooming: android pinch zoom

Community
  • 1
  • 1
Sanat Pandey
  • 4,081
  • 17
  • 75
  • 132