【发布时间】:2020-09-06 07:15:01
【问题描述】:
我使用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 布局高度。任何支持将不胜感激。
【问题讨论】: