我使用SortableTableView作为我的表格视图,但在组件正下方包含一个 TextView 时遇到了问题。
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<de.codecrafters.tableview.SortableTableView
android:id="@+id/tableView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:tableView_columnCount="4"
app:tableView_headerElevation="10" />
<TextView
android:id="@+id/txtSummaryRecords"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Summary details goes here"
android:layout_below="@+id/tableView"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:attr/colorError" />
</RelativeLayout>
但是,当我将静态值添加到如下高度时,它会显示在表格的正下方。
<de.codecrafters.tableview.SortableTableView
android:id="@+id/tableView"
android:layout_width="match_parent"
android:layout_height="450dp" <--included value
app:tableView_columnCount="4"
app:tableView_headerElevation="10" />
结果:
我尝试设置android:layout_height=并match_parent没有区别。看起来 SortableTableView 填充了整个屏幕,而不考虑wrap_content布局高度。任何支持将不胜感激。

