Android 垂直滚动条在水平滚动条内不可见
我在水平滚动条中有一个垂直滚动条。 垂直滚动条仅在水平向右滚动时可见。但我希望它总是可见的 我该怎么做?有什么帮助吗?提前谢谢 我的xml看起来像这样Android 垂直滚动条在水平滚动条内不可见,android,scroll,scrollbar,Android,Scroll,Scrollbar,我在水平滚动条中有一个垂直滚动条。 垂直滚动条仅在水平向右滚动时可见。但我希望它总是可见的 我该怎么做?有什么帮助吗?提前谢谢 我的xml看起来像这样 <HorizontalScrollView android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_below="@id/gridTitle" android:layout_marginL
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/gridTitle"
android:layout_marginLeft="30dp"
android:layout_marginRight="18dp"
android:layout_marginBottom="5dp"
android:fadeScrollbars="false" >
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginBottom="13dp">
<!-- This Table Layout is header followed by the table itself-->
<TableLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:stretchColumns="*" >
<TableRow
android:id="@+id/tableHeader"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</TableRow>
</TableLayout>
<ScrollView
android:id="@+id/verticalScroll"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:fadeScrollbars="false">
<TableLayout
android:id="@+id/layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="12dp"
android:stretchColumns="*" >
</TableLayout>
</ScrollView>
</LinearLayout>
</HorizontalScrollView>
编辑:
问题是,垂直滚动条在屏幕之外(如果我有很多表列),所以我只能在水平滚动时才能看到它,但我希望它始终可见 只需删除
android:fadeScrollbars="false"
行或使其为真
。阅读
android:fadeScrollbars=>
定义不使用滚动条时是否淡出滚动条
编辑
在视图中尝试以下两行。我删除了行android:fadeScrollbars=“false”
,并在下面添加了2行
android:scrollbarFadeDuration="0"
android:scrollbarDefaultDelayBeforeFade="0"
使用ScrollView.SetScrollBarFadinEnabled(false) 你想在scrollview或horizontalscrollview中使用滚动条?@Tünde,我编辑我的答案。请检查一下。我在GridView中尝试过。它对我来说很好。你也可以在表格视图中水平滚动?我的滚动条的淡入淡出属性没有问题。我的问题是它在屏幕之外(如果我有很多表列),所以我只能在水平滚动时看到它。(对不起,如果我没有正确解释我自己…)我还没有实现你的布局。我给出的答案是基于“总是滚动条可见”。android官方网站不建议在另一个
可滚动视图中使用任何可滚动视图
。好的,那么你知道我应该如何以其他方式实现此功能吗?我真的需要我的表能够水平和垂直滚动,这就是我发现的方法。