Open ghost opened 5 years ago
Hi @evrencoskun - have you got any idea? :) Is there any solution?
Hi @HubertLaczak , I have the same issue, have you found the solution?
Hi @evrencoskun - How can I set width match parent programatically?
Any update?
While i using to table with four header it was not covering the page.I solved this problem following methods. Optional(I hide the all row items in the table) - binding.myTableView.setAdapter(mTableAdapter); binding.myTableView.setRowHeaderWidth(0); in MyTableViewAdapter:
public MyTableViewAdapter(Context context, int size) { // size :: for dynamic header items mContext = context; screenWidth = utils.getScreenWidth(); headerWidth = (int) (screenWidth / size); }
later i sent header width to Header
public ColumnHeaderViewHolder(TableviewColumnHeaderLayoutBinding binding) {
super(binding.getRoot());
this.binding = binding;
}
public void setColumnHeaderModel(ColumnHeaderModel key, int pColumnPosition) {
// Set text data
binding.columnHeaderTextView.setText(key.getData());
// binding.columnHeaderContainer.getLayoutParams().width = LinearLayout.LayoutParams.WRAP_CONTENT;
i changed this code to this-->
binding.columnHeaderContainer.getLayoutParams().width = headerWidth;
binding.columnHeaderTextView.requestLayout();
}
OK , nice works :)
I have a trouble with the width of a specific column/cell.. as we know, it is necessary to use:
column_header_container.getLayoutParams().width = LinearLayout.LayoutParams.WRAP_CONTENT;
to set the width of a column. It is possible to change it also to MATCH_PARENT. But.. what in the case that I want to set w width according to having full screen table? I have only 3 columns which take place of 1/3 of the screen's width.On the other hand, with
column_header_container.getLayoutParams().width = LinearLayout.LayoutParams.MATCH_PARENT;
one column takes the rest of free width and without scrolling there is only first(main/category) column and that specific one..I have a ConstraintLayout layout with:
<com.evrencoskun.tableview.TableView android:id="@+id/content_container" android:layout_width="0dp" android:layout_height="0dp" android:layout_marginStart="8dp" android:layout_marginTop="8dp" android:layout_marginEnd="8dp" android:layout_marginBottom="8dp" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" />
but TableView takes as much space as WRAP_CONTENT for each columns is needed. Now, the Activity looks like: but I want:
without hardcoding the width. Thanks for help :)