Closed luonglegs closed 3 years ago
Hi @luonglegs,
row_header_width
belongs to app resource, and your views in the TableView use it.
The problem is you didn't set any row header width value for your TableView. So it uses its default row header width value "default_row_header_width
" which in its resource.
So, you need to override default_row_header_width value like this;
<dimen name="row_header_width">180dp</dimen>
<!-- Overriding the default values of the tableView -->
<dimen name="default_row_header_width">180dp</dimen>
or you can set width value programmatically using TableView.setRowHeaderWidth
function. For example in your Fragment.
// Load the dummy data to the TableView
tableViewAdapter.setAllItems(tableViewModel.getColumnHeaderList(), tableViewModel
.getRowHeaderList(), tableViewModel.getCellList());
...
mTableView.setRowHeaderWidth(600);
But in that case, you also need to change your table_view_row_header_layout
.xml file because, in the sample app, it uses "row_header_width
" as a constant value otherwise it shows up like this.
just change it to this;
android:layout_width="match_parent"
Lastly, you can also set the value using XML attributes;
<com.evrencoskun.tableview.TableView
android:id="@+id/content_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
// set width value
app:row_header_width="@dimen/row_header_width"
/>
Ah hah! Thank you. So could you explain, if the XML for CornerView had used dimen value of like 180dp in your example, why does it use the default value even though it's specified otherwise? Should we just always override the default value?
Or does it break because the RowHeader's width was using the default value, default_row_header_width
, while the corner was actually using the row_header_width
value?
Describe the bug It seems there's some limitations of the CornerView that i'm not aware of. When I set the CornerView AND the RowHeaderView width's to something bigger like 180dp, the CornerView's width looks like it stays the same but the RowHeaderView's cells get cut off or blank.
To Reproduce Steps to reproduce the behavior:
Expected behavior I expect both cornerview and rowheaderview widths to be the set dimens value. Since in the sample app both widths are being set to the same value.
Screenshots
Tools:
TableView
version: 0.8.9.2