Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

For some reason I can't horizontally scroll through my linear layout...

I tried this solution and it didn't work: LinearLayout not expanding inside a ScrollView

Is there something else that I'm missing?

Here is my code:

<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fadingEdge="horizontal"
    android:scrollbars="horizontal"
    android:fillViewport="true" >

 <LinearLayout
     android:layout_width="fill_parent"
     android:layout_height="fill_parent"
     android:orientation="horizontal"
     android:scrollbarStyle="insideOverlay"
     android:scrollbars="horizontal" >

     <ImageButton
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:background="@drawable/ventuscartoon" >

     </ImageButton>

     <ImageButton
         android:id="@+id/imageButton1"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:src="@drawable/eincartoon" />

     <ImageButton
         android:id="@+id/imageButton3"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:src="@drawable/ventuscartoon" />

     <ImageButton
         android:id="@+id/imageButton2"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:src="@drawable/ventuscartoon" />

</LinearLayout>

</ScrollView>

Thanks!

share|improve this question

1 Answer 1

up vote 2 down vote accepted

If you want to scroll horizontally you should probably use HorizontalScrollView instead of ScrollView

share|improve this answer
    
wow. I completely missed that there was a Horizontal ScrollView... Thanks! It worked perfectly right away. haha. –  cskoala Sep 16 '12 at 19:58
    
haha it happens!! –  Juan Manuel Sep 16 '12 at 20:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.