SortableTableView
SortableTableView copied to clipboard
How to highlight row when clicked on it
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
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
Hi @ISchwarz23 ,
thnaks for update any example for custom TableDataRowBackgroundProvider.
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