Ricezione di messa a fuoco Modifica eventi per un tovaglia dinamico
-
15-11-2019 - |
Domanda
Ho un tablelayout che è focalizzabile. Aggiungo dinamicamente ai tablows a questo tablelayout.
Sebbene io possa ottenere il tablerow e il suo contenuto (poche parole con testo), per rispondere agli eventi touch, non riesco a ottenere nessuno di loro per rispondere agli eventi di messa a fuoco.
Oltre a impostare un onfocuschangelistener, c'è qualcos'altro che devo fare?
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);
. Soluzione 2
I was using the wrong component for the UI interaction I was looking for.
Altri suggerimenti
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?
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow