2017-02-28 45 views

回答

1

下面的走了進去,

onAccessibilityEvent(AccessibilityEvent event){} 

然後,

//Get the source 
AccessibilityNodeInfo source = event.getSource(); 

//Grab the parent of the view that fired the event. 
AccessibilityNodeInfo rowNode = getListItemNodeInfo(source); 

//Using this parent, get references to child node, the selected text 
AccessibilityNodeInfo textNode = rowNode.getChild(0); 

//Get the text values 
String text = textNode.getText(); 

OR

或者在你的情況下,以下應該工作得很好。因爲它是一個「typeViewTextSelectionChanged」事件,顯然它來自EditText。

String text=event.getText(); 

欲瞭解更多信息,看看herehere

+0

我似乎無法找到任何getListItemNodeInfo文件,請您鏈接到你見過? – Jayce

相關問題