如何使线性布局水平滚动

发布于 2024-11-15 03:35:40 字数 772 浏览 8 评论 0原文

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

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

My application containing different layouts.one of them is a linear layout.it's content is dynamically adding.i want to make this layout horizontally scrollable.for this i have put my layout in a scroll view.but still it s not scrolling...given below is my code

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

温柔一刀 2024-11-22 03:35:40

使用 Horizo​​ntalScrollView 代替

另外,您的布局在其内容无法适合布局区域后也会变成可滚动的。

Use HorizontalScrollView instead

Also your layout will become scrollabe after its contect can't fit layout area.

我为君王 2024-11-22 03:35:40

只需在 xml 中使用它即可
android:fadeScrollbars="true" 可能适合你

Simply use this in xml
android:fadeScrollbars="true" may be it works for you

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文