SortableTableView icon indicating copy to clipboard operation
SortableTableView copied to clipboard

How to highlight row when clicked on it

Open sakaravinth opened this issue 6 years ago • 3 comments

How to highlight row when clicked on it .I tried using layout but not working,

Code in getCellView in table adapter if (selectedRowIdx == rowIndex) if (textView!= null) textView.setBackground(ContextCompat.getDrawable(mContext, R.drawable.rounded_border_edittext)); //////////

Code for custom layout private View renderProducerLogo(String data, ViewGroup parentView, int selectedRowIdx, int rowIndex) { final View view = getLayoutInflater().inflate(R.layout.table_cell_report, parentView, false); final RelativeLayout rLayout_tc_rprt = (RelativeLayout) view.findViewById(R.id.rLayout_tc_rprt);

    final TextView txtVw_tc_rprt = (TextView) view.findViewById(R.id.txtVw_tc_rprt);
    txtVw_tc_rprt.setText(data);
    if (selectedRowIdx == rowIndex)
        if (rLayout_tc_rprt != null)
            rLayout_tc_rprt.setBackgroundColor(getResources().getColor(R.color.colorPrimary));

// textView.setBackground(ContextCompat.getDrawable(mContext, R.drawable.rounded_border_edittext))

    return view;
}

// Thanks in advance highlight_row_tableview

sakaravinth avatar Aug 21 '18 05:08 sakaravinth

Hi @sakaravinth,

you can implement a custom TableDataRowBackgroundProvider. The pro version of this library also comes with SelectionHelper which is handling exactly this use case.

Best regards, Ingo

ISchwarz23 avatar Aug 21 '18 08:08 ISchwarz23

Hi @ISchwarz23 ,

thnaks for update any example for custom TableDataRowBackgroundProvider.

sakaravinth avatar Aug 21 '18 09:08 sakaravinth

Hi @ISchwarz23

For my case full row want to be highlighted when click on row.Like as seen in below picture(Rectangle-orange color). Thanks highlight_row_tableview

sakaravinth avatar Aug 21 '18 10:08 sakaravinth