TableView icon indicating copy to clipboard operation
TableView copied to clipboard

How to make table FullScreen?

Open ghost opened this issue 6 years ago • 5 comments

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: 56205063_895633287495230_1891034084218503168_n but I want: 55597550_2041960472772059_6662719574430973952_n

without hardcoding the width. Thanks for help :)

ghost avatar Mar 27 '19 14:03 ghost

Hi @evrencoskun - have you got any idea? :) Is there any solution?

HubertLaczak avatar May 07 '19 08:05 HubertLaczak

Hi @HubertLaczak , I have the same issue, have you found the solution?

miloradtrninic avatar Aug 06 '19 21:08 miloradtrninic

Hi @evrencoskun - How can I set width match parent programatically?

surhidamatya avatar Aug 12 '19 11:08 surhidamatya

Any update?

nitink133 avatar Apr 08 '20 07:04 nitink133

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 :)

egeysn avatar Mar 01 '21 19:03 egeysn