Recepción de eventos de cambio de enfoque para un cuadro dinámico
-
15-11-2019 - |
Pregunta
Tengo un tablejout que se enfoca. Dinamentamente agrego a los tablerows a este tablelayout.
Aunque puedo obtener el cuadro de la tabla, y sus contenidos (algunas vistas de texto), para responder a los eventos táctiles, no puedo conseguir que ninguno de ellos responda a los eventos de enfoque.
Aparte de establecer un OnFocusChangelistener, ¿hay algo más que necesite hacer?
TableRow tableRow = new TableRow(this); // "this" is a valid Context...
tableRow.setFocusableInTouchMode(true);
tableLayout.addView(tableRow);
TextView someNameTextView = new TextView(this);
someNameTextView.setText("Foo");
someNameTextView.setFocusableInTouchMode(true);
tableRow.addView(someNameTextView);
tableRow.setOnFocusChangeListener(someRowFocusChangeListener);
someNameTextView.setOnFocusChangeListener(someRowFocusChangeListener);
Solución 2
I was using the wrong component for the UI interaction I was looking for.
Otros consejos
Are you actually calling setFocusable
(see http://developer.android.com/reference/android/view/View.html#setFocusable%28boolean%29) on the View
s and TableRow
s?
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow