0
我正在使用Android 4.0.3。我試圖從WebView中選擇文本並將其保存爲字符串。我試過這個代碼:突出顯示並保存來自WebView的選定文本?
public void SelectText(){
try{
KeyEvent shiftPressEvent =
new KeyEvent(0, 0, KeyEvent.ACTION_DOWN,
KeyEvent.KEYCODE_SHIFT_LEFT, 0, 0);
shiftPressEvent.dispatch(mWebView);
}catch(Exception e){
throw new AssertionError(e);
}
但它不起作用。在Android 4中,已經有一個用於選擇文本的內置菜單,但是如何覆蓋此菜單?