views:

54

answers:

1

Hello,

I'm currently working on a game for android.

I have three ImageView's next to each other, they're positioned next to each other using the "android:layout_toRightOf". The views are located within a RelativeLayout tag. Each of these views are centered into the middle of the screen using "android:scaleType="fitCenter"" and they fill the entire screen.

I'm attempting to implement a horizontal scroll from one view to another so that I basically get one view on my screen at a time.

Here is the code that I'm currently using

<HorizontalScrollView android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:fillViewport="true"
      android:scrollbars="none">
  <RelativeLayout android:id="@+id/GameBg"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content">
     <ImageView  android:id="@+id/GameImageContainer3"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:scaleType="fitCenter"
      android:layout_toRightOf="@+id/GameImageContainer2"
      />
     <ImageView  android:id="@+id/GameImageContainer2"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:scaleType="fitCenter"
      android:layout_toRightOf="@+id/GameImageContainer1"
      /> 
     <ImageView  android:id="@+id/GameImageContainer1"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
      android:scaleType="fitCenter"
      />
  </RelativeLayout>
</HorizontalScrollView>

What I'm currently getting is three images next to each other -- but sometimes they take up less then an entire screen. I want both the left and right padding to be correct, so that I can only see one image at a time.

Any ideas?

A: 

Have you tried the Gallery Widget. It seems to be what you are looking for. Be sure to also check out the Gallery tutorial.

iPaulPro