【发布时间】:2020-06-23 05:29:08
【问题描述】:
我有一个带有约束布局的可滚动视图/布局。
在这个布局里面我有很多其他的东西。在布局的底部,我需要一个以编程方式创建的表格布局。
如何使这个 TableLayout 可以水平滚动?
<ScrollView
android:id="@+id/testlay"
android:layout_width="match_parent"
android:layout_height="400dp"
android:layout_marginTop="5dip"
android:layout_marginStart="60dp"
android:fillViewport="false"
android:scrollbarStyle="outsideInset"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/linearLayoutProductTableHeader">
<TableLayout
android:id="@+id/linearLayoutProductTable"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:gravity="center"
android:isScrollContainer="true"
android:stretchColumns="*"
tools:ignore="MissingConstraints">
</TableLayout>
</ScrollView>
我也尝试在 ScrollView 中使用 HorizontalLayout,但它不起作用。
【问题讨论】:
标签: android kotlin scroll scrollview tablelayout