2012-02-26 160 views
0

我只是将一个ScrollView添加到LinearLayout中,无论我更改它们的宽度,它都不会滚动。我是新手,任何人都帮我解决问题?提前致谢!为什么不滚动?

<ScrollView 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:scrollbarStyle="outsideOverlay" 
    android:scrollbars="horizontal" > 

    <LinearLayout 
     android:layout_width="1000dp" 
     android:layout_height="wrap_content" 
     android:gravity="center" > 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/widget_box_action_1" /> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/widget_box_action_2" /> 

     <ImageView 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/widget_box_action_3" /> 

     ... 
    </LinearLayout> 
</ScrollView> 
+0

你真的想滚动水平吗? – Moritz 2012-02-26 09:57:51

回答

0

set android:layout_width="wrap_content" linearlayout,而不是1000dp。

0

如果你想检查它为什么不滚动尝试为滚动视图设置android:layout_height="100dip"。你想要显示的内容就足够了,很容易在屏幕上显示出来。如果有更多的内容,那么滚动视图将滚动。也设置android:layout_width="fill_parent“的linearlayout而不是1000dp设置为fill_parent

0

它看起来像当你设置你的ScrollView你告诉它填充屏幕宽度fill_parent请尝试下面的代码如果我正确理解你想要水平滚动

<ScrollView 
    android:layout_width="1000dip" 
    android:layout_height="fill_parent" 
    android:scrollbarStyle="outsideOverlay" 
    android:scrollbars="horizontal" > 

    <LinearLayout 
     android:layout_width="1000dip" 
     android:layout_height="fill_parent" 
     android:gravity="center" >