• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Need help with HorizontalScrollView

totsie

Lurker
Jan 21, 2010
3
0
Hope someone can help me with my very simple problem.

I have been trying to implement a horizontalScrollView. Here is my sample code.

Code:
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/scrollview"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:orientation="horizontal"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >

        <ImageView
            android:src="@drawable/icon"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"/>
        
    </LinearLayout>
</HorizontalScrollView>

I intend to add about 8 ImageViews in my linear horizontal layout ( have shown only 1 for ease of reading), and be able to scroll through them using key presses.

This code just doesn't run on the emulator though. I get errors like "Application <activity name> has stopped unexpectedly. Please try again later"

Can anyone help me?

-- Totsie
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones