English 中文(简体)
通过背景行动在网上通话
原标题:Getting selected text in a WebView via a contextual action bar

已知为WebTextView

然而,随着最近发行的Android 4.0 Design guidelines,似乎有一线希望通过环境行动条码实现这一点。 http://developer.android.com/search/patterns/action.html“rel=“nofollow noreferer”>says :

每当你允许用户通过长篇新闻选择数据时,使用自动交换机。 您可以控制CAB的行动内容,以便插入你希望用户能够采取的行动。

我错过了吗? 有办法通过CAB从网上检索某些文本?

在漫长的点击和案文选择模式开始后,我现在可以发现:ActionMode/code>开始并修改原始复制/pasteMenu;然而,我可以清楚地说明如何实际检索选定的案文。

最佳回答

你们现在可以这样做。

我就此提出特别要求——第24841期: http://code.google.com

基本上,4.0号网上意见硬化了自己的背景行动律师。 CAB参考了网上意见,并参考了这一参考文献,可以取得选定的案文。 我不敢肯定你如何能够发现“行动模式”的开端和更改菜单,但如果你能够这样做的话,那么你会因为“选择”是一揽子的——非公开的。 我提出,这是一个单独的问题,与前面的问题有关。

问题回答

您可以使用javascript获得选定文本:窗户选择,并使用WebView增加JavascriptInterface功能来回报结果。

thanks for your information, I have solved a hard issue.. I just want to add some function into the actionmode. The following is my code, May be helpful to others.

@Override
public ActionMode onWindowStartingActionMode(Callback callback) {
    // TODO Auto-generated method stub
    ActionMode mode = super.onWindowStartingActionMode(callback);
    mode.getMenuInflater().inflate(R.menu.actions, mode.getMenu());
    mode.getMenu().findItem(R.id.action_add).setOnMenuItemClickListener(new OnMenuItemClickListener() {

        @Override
        public boolean onMenuItemClick(MenuItem item) {
            // TODO Auto-generated method stub
            Log.i("", "onMenuItemClick add ");
            return false;
        }
    });
    return mode;
}




相关问题
Android - ListView fling gesture triggers context menu

I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...

AsyncTask and error handling on Android

I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...

Android intent filter for a particular file extension?

I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...

Android & Web: What is the equivalent style for the web?

I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...

TiledLayer equivalent in Android [duplicate]

To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?

Using Repo with Msysgit

When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...

Android "single top" launch mode and onNewIntent method

I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...

From Web Development to Android Development

I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...