【问题标题】:Setting the properties for ScrollView in LinearLayout - Android在 LinearLayout 中设置 ScrollView 的属性 - Android
【发布时间】:2015-02-19 03:53:42
【问题描述】:

如何设置两个 LinearLayout 中存在的以下 ScrollView 的属性,以便它们可滚动。我正在以编程方式向两个 LinearLayouts 添加视图。

    <ScrollView  > 
        <LinearLayout
            android:id="@+id/linearLeft"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="left"
            android:layout_weight="0.2"
            android:background="#88FF0000"
            android:orientation="vertical" >
        </LinearLayout>
    </ScrollView>

    <ScrollView > 
        <LinearLayout
            android:id="@+id/linearRight"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_gravity="right"
            android:layout_weight="0.8"
            android:background="#8800FF00"
            android:orientation="vertical" >
        </LinearLayout>
     </ScrollView>

 </LinearLayout>

【问题讨论】:

  • 这不是你的实际布局,我假设?您应该添加完整的布局。你能更清楚你的意思吗?
  • 所以你基本上想要 2 个并排滚动视图,单独滚动?
  • 请提供完整的 Xml :)
  • @Droidekas 是的...我想用单独的滚动条并排滚动 2 个视图...这是我完整的 XML...我通过代码添加其余部分

标签: android android-layout scrollview android-scrollview


【解决方案1】:

我终于解决了我的问题,这是我的代码。抱歉,我的问题不清楚。

<ScrollView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_gravity="left"
    android:layout_weight="0.2" >

    <LinearLayout
        android:id="@+id/linearLeft"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#88FF0000"
        android:orientation="vertical" >
    </LinearLayout>
</ScrollView>

<ScrollView
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_gravity="right"
    android:layout_weight="0.8" >

    <LinearLayout
        android:id="@+id/linearRight"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="#8800FF00"
        android:orientation="vertical" >
    </LinearLayout>
 </ScrollView>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-31
    • 2012-06-05
    • 2018-04-23
    • 1970-01-01
    • 1970-01-01
    • 2016-04-15
    相关资源
    最近更新 更多