C# SortableView不将高度包装到其内容
我正在使用作为我的表视图,但在组件正下方包含TextView时遇到问题C# SortableView不将高度包装到其内容,c#,android,xaml,xamarin,sortable-tables,C#,Android,Xaml,Xamarin,Sortable Tables,我正在使用作为我的表视图,但在组件正下方包含TextView时遇到问题 但是,当我将静态值添加到高度(如下所示)时,它将显示在表格的正下方 <de.codecrafters.tableview.SortableTableView android:id="@+id/tableView" android:layout_width="match_parent" android:layout_height="450dp" <--included value
但是,当我将静态值添加到高度(如下所示)时,它将显示在表格的正下方
<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" />
我也发现了这个问题,似乎默认高度已经是match\u parent
如果您希望文本视图位于底部,而sortableview位于其上方,您可以像下面这样做作为解决方法
<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="match_parent"
android:layout_below="@id/toolbar"
android:layout_above="@+id/txtSummaryRecords"
app:tableView_columnCount="4"
app:tableView_headerElevation="10"
app:tableView_headerColor="@color/primary" />
<TextView
android:id="@+id/txtSummaryRecords"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Summary details goes here"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:attr/colorError" />
</RelativeLayout>
@ingo schwarz感谢您的图书馆。你能想出什么原因吗?谢谢@leo,但是这种方法在表和文本视图之间也有很大的差距。@我可以,如果你没有足够的数据,就会有差距。但另一方面,如果包装内容有效,当有足够的数据时。我想文本视图也会不可见,因此,将textview固定在屏幕底部可能是一个相对可接受的解决方案,除非您根据源代码自定义SortableView。同意您的观点。是否有方法覆盖SortableView的属性?
<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="match_parent"
android:layout_below="@id/toolbar"
android:layout_above="@+id/txtSummaryRecords"
app:tableView_columnCount="4"
app:tableView_headerElevation="10"
app:tableView_headerColor="@color/primary" />
<TextView
android:id="@+id/txtSummaryRecords"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="Summary details goes here"
android:layout_alignParentBottom="true"
android:gravity="center_horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textColor="?android:attr/colorError" />
</RelativeLayout>