2015-05-27 48 views

回答

2

它不垂直,其水平是

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

    <HorizontalScrollView 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:orientation="horizontal"> 
     // Add your ImageButtons 
    </LinearLayout> 
</HorizontalScrollView> 

+0

如果我现在在这个LinearLayout中放置像ImageButton这样的元素,它们将会垂直滚动吗? –

+0

是的,试试吧。如果我的答案有效,那就接受它。 – Exigente05

+0

可悲的是它没有:/ –

0

你必须滚动视图设置为

android:fillViewport="true" 

下面是完整的代码

<ScrollView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:tools="http://schemas.android.com/tools" 
      android:id="@+id/myscrollView" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:fillViewport="true"> 
</ScrollView>