我完全搞不懂表格布局卷轴。我必须实现水平和垂直滚动表格。我也见过表修复标题示例,但tablefixheader示例使用了适配器来设置数据,但我需要在表布局中使用add-view方法。我使用了下面的代码,但它不能支持双向滚动
<ScrollView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical" >
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="fill_parent"
android:fadeScrollbars="false">
<TableLayout
android:id="@+id/tableLayoutId"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</HorizontalScrollView>
</ScrollView>
发布于 2013-05-18 18:50:32
这是我实现它的方式,对我来说是有效的:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ScrollView
android:id="@+id/layout"
android:layout_height="match_parent"
android:scrollbars="horizontal|vertical"
android:layout_width="match_parent"
android:layout_marginTop="5dip"
android:scrollbarStyle="outsideInset"
android:fillViewport="true">
<HorizontalScrollView
android:id="@+id/horizontalView"
android:layout_height="wrap_content"
android:scrollbars="horizontal|vertical"
android:layout_width="wrap_content"
android:layout_marginTop="5dip">
<TableLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/tlGridTable" >
</TableLayout>
</HorizontalScrollView>
</ScrollView>
</LinearLayout>
看一下这段代码,看看这是否有帮助。
发布于 2017-09-20 19:58:32
像这样添加
<ScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scrollbars="vertical">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/rv_pins"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scrollbarStyle="outsideOverlay"
android:scrollbars="horizontal" />
</HorizontalScrollView>
</ScrollView>
https://stackoverflow.com/questions/16623337
复制相似问题