How to move to the next image in the horizontal ScrollView in android
I am using gallery
to add the images and use the horizontal 开发者_如何学JAVAScrollView
for scrolling the images of the gallery. Now the problem is, if I flip the first image then it does not go to next image, it displays improperly.
@ram try this code for horizontalscrollview :
HorizontalScrollView sView = (HorizontalScrollView)findViewById(R.id.ScrollView01); sView.setVerticalScrollBarEnabled(false); sView.setHorizontalScrollBarEnabled(true);
and use this xml scrollview.xml
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="100dp"
android:orientation="vertical" >
<HorizontalScrollView
android:id="@+id/ScrollView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="none" >
<LinearLayout
android:id="@+id/LinearLayout02"
android:layout_width="fill_parent"
android:layout_height="90dp"
android:layout_marginTop="10dp"
android:orientation="horizontal" >
<Button
android:id="@+id/Button01"
android:layout_width="wrap_content"
android:layout_height="40dp"
android:background="@drawable/ic_launcher"
>
</Button>
I think you should try following example.
精彩评论