0

I have a tablelayout where I need to select a row to do something with it latter. The problem is, when I scroll it selects a new row. What I want it a way to not select a row when I only want to scroll

What I have for selecting a row is this:

...
TableRow tR = new TableRow(this);
 final TableLayout tabela = (TableLayout)findViewById(R.id.tableLayout1);
...
tR.setOnTouchListener(new OnTouchListener() {
public boolean onTouch(View arg0, MotionEvent arg1) {
    tabela.getFocusedChild().setBackgroundResource(R.drawable.gray1);//remove the old selected row
    arg0.requestFocus(); //add new one
    arg0.setBackgroundColor(Color.parseColor("#FFFF00")); //add new one
    return false;
}});

I think It' something to do with that "MotionEvent arg1" but I dont really know what to do with it. Thanks in advance for your help

user1772093
  • 87
  • 1
  • 2
  • 8
  • try this http://stackoverflow.com/questions/4075356/how-can-i-highlight-the-table-row-on-click/13950667#13950667 – ShreeshaDas Dec 23 '12 at 11:26

1 Answers1

0

I already found a way to solve this. I only needed to add

if(arg1.getAction() == MotionEvent.ACTION_UP){

before the code

user1772093
  • 87
  • 1
  • 2
  • 8