【问题标题】:how to make a linear layout horizontall scrollable如何使线性布局水平滚动
【发布时间】:2011-06-14 13:10:55
【问题描述】:

我的应用程序包含不同的布局。其中一个是线性布局。它的内容是动态添加的。我想让这个布局水平滚动。为此我把我的布局放在滚动视图中。但它仍然没有滚动...下面是我的代码

 <LinearLayout android:id="@+id/scoreballparent_layout"
  android:layout_height="wrap_content"
  android:orientation="horizontal"
   android:layout_width="fill_parent"
  android:layout_above="@+id/score_layout">
  <ScrollView android:layout_height="wrap_content" 
  android:id="@+id/scrollView1" 
  android:layout_width="fill_parent" 
  >
      <LinearLayout android:layout_width="fill_parent" 
      android:id="@+id/scoreball_layout" 
      android:layout_height="wrap_content"
      android:isScrollContainer="true" 
      android:scrollbars="horizontal">

         </LinearLayout>
     </ScrollView>
</LinearLayout>

【问题讨论】:

  • 请注意,如果内容适合屏幕,则不会出现滚动条。

标签: android android-linearlayout horizontal-scrolling


【解决方案1】:

改用HorizontalScrollView

此外,您的布局在其内容无法适应布局区域后将变为可滚动。

【讨论】:

  • 谢谢...但是一件事..它在滚动时显示滚动条。我不想显示那个..我想在向这个布局中添加新东西时自动滚动布局..可以你帮我请..
【解决方案2】:

只需在 xml 中使用它 android:fadeScrollbars="true" 可能对你有用

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-26
    • 2015-07-27
    • 1970-01-01
    相关资源
    最近更新 更多