【问题标题】:LinearLayout Inside of ScrollView doesn't expandScrollView 内部的 LinearLayout 不展开
【发布时间】:2012-09-17 03:51:47
【问题描述】:

由于某种原因,我无法水平滚动我的线性布局...

我尝试了这个解决方案,但没有成功:LinearLayout not expanding inside a ScrollView

我还有什么遗漏的吗?

这是我的代码:

<?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>

谢谢!

【问题讨论】:

    标签: android android-layout android-linearlayout android-scrollview


    【解决方案1】:

    如果你想水平滚动,你应该使用 Horizo​​ntalScrollView 而不是 ScrollView

    【讨论】:

    • 哇。我完全错过了有一个水平滚动视图......谢谢!它立即完美运行。哈哈。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多