TableView icon indicating copy to clipboard operation
TableView copied to clipboard

Corner View not shown

Open aashitshah26 opened this issue 4 years ago • 7 comments

  This is my xml file

     `<com.evrencoskun.tableview.TableView
    android:id="@+id/tableView"
    android:layout_below="@id/rel"
    android:layout_width="match_parent"
    android:layout_height="match_parent"


    app:row_header_width="@dimen/_80sdp"
    app:column_header_height="@dimen/_30sdp"
    app:selected_color="@color/white"
    app:shadow_color="@color/white"
    app:allow_click_inside_cell="true"
    app:allow_click_inside_row_header="true"
    app:allow_click_inside_column_header="true"

    app:unselected_color="@color/white"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    />`

My corner view

` <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="@dimen/_80sdp" android:layout_height="@dimen/_40sdp" android:orientation="vertical" android:gravity="center">

<TextView
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="States/UT"
    android:textSize="@dimen/_12ssp"
    android:padding="@dimen/_5sdp"
    android:textColor="@color/black"/>

</LinearLayout>`

i have returned this view from method onCreateCornerView()

aashitshah26 avatar Apr 16 '20 10:04 aashitshah26

same problem to me

juanlabrador avatar Apr 23 '20 21:04 juanlabrador

@juanlabrador @aashitshah26 There's a bug in the library. If you use methods for separate columns, rows & cells setting instead of setAllItems() - corner view is not added to the layout. I had to fix it for myself manually in the code. So for now there are 3 options:

  1. Wait for the fix
  2. Add the library as a module to your project and fix the problem manually (add code with the corner view adding to the container FrameLayout)
  3. Use setAllItems() method

olegabd avatar May 24 '20 15:05 olegabd

Corner View is currently not shown if any of the column or row headers or cells have no data.

In my case I have column headings but no data for the rows (cells and row headings)> This produces an odd view of:-

image

I think it a fairly normal case if your have column headings you would want to display the corner view (which is a column heading of the row headings)

If you have zero column heading, zero row heading and zero data then you would expect no corner view as well.

As this is a change in behaviour I feel that this should be optional not to break people who expect the existing behaviour.

I have a change prepared to optionally produced:-

image

Once I have fully tested it I'll make a pull request for this.

Zardozz avatar Jun 29 '20 17:06 Zardozz

I faced this problem and I found the easiest solution is calling getCornerView() and update view visibility after calling setAllItems() method getCornerView().visibility = View.VISIBLE

Mohamadkotb avatar Sep 21 '20 09:09 Mohamadkotb

@Mohamadkotb no, not works for me. I have to added empty row to end table for showing corner. Thanks @Zardozz

juanlabrador avatar Oct 06 '20 04:10 juanlabrador

This should be able to be closed with the release of 0.8.9.4

You can now call setShowCornerView(true) on the tableView before you set the adapter, so that the cornerview is drawn even if you don't have any row headers (and rows)

Results as per comment https://github.com/evrencoskun/TableView/issues/308#issuecomment-651248087

Zardozz avatar Mar 23 '21 22:03 Zardozz