当前位置: 首页>>代码示例>>Java>>正文


Java WebView.requestFocus方法代码示例

本文整理汇总了Java中android.webkit.WebView.requestFocus方法的典型用法代码示例。如果您正苦于以下问题:Java WebView.requestFocus方法的具体用法?Java WebView.requestFocus怎么用?Java WebView.requestFocus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.webkit.WebView的用法示例。


在下文中一共展示了WebView.requestFocus方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onPageFinished

import android.webkit.WebView; //导入方法依赖的package包/类
public void onPageFinished(WebView view, String url) {
    super.onPageFinished(view, url);

    // CB-10395 InAppBrowser's WebView not storing cookies reliable to local device storage
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        CookieManager.getInstance().flush();
    } else {
        CookieSyncManager.getInstance().sync();
    }

    // https://issues.apache.org/jira/browse/CB-11248
    view.clearFocus();
    view.requestFocus();

    try {
        JSONObject obj = new JSONObject();
        obj.put("type", LOAD_STOP_EVENT);
        obj.put("url", url);

        sendUpdate(obj, true);
    } catch (JSONException ex) {
        LOG.d(LOG_TAG, "Should never happen");
    }
}
 
开发者ID:disit,项目名称:siiMobilityAppKit,代码行数:25,代码来源:InAppBrowser.java

示例2: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
/**
 * Called when the activity is first created. Set the web view layout and
 * get the title and file to be displayed.
 * 
 * @param savedInstanceState
 *            Is used to save the state of the created Activity.
 * 
 * @author Yuriy Stanchev
 * 
 * @email [email protected]
 * 
 * @date 11 Mar 2012
 */
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	Intent intent = getIntent();
	Bundle extras = intent.getExtras();

	String title = (String) extras.get("title");
	String file = (String) extras.get("file");

	setContentView(R.layout.about);

	setTitle(title);

	WebView view = (WebView) findViewById(R.id.web);

	view.setFocusable(true);
	view.setFocusableInTouchMode(true);
	view.requestFocus();
	view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
	view.loadUrl(file);

}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:37,代码来源:AboutActivity.java

示例3: focusSkipButton

import android.webkit.WebView; //导入方法依赖的package包/类
private void focusSkipButton() {
  if (playingAd && adUiViewGroup != null && adUiViewGroup.getChildCount() > 0
      && adUiViewGroup.getChildAt(0) instanceof WebView) {
    WebView webView = (WebView) (adUiViewGroup.getChildAt(0));
    webView.requestFocus();
    webView.loadUrl(FOCUS_SKIP_BUTTON_WORKAROUND_JS);
  }
}
 
开发者ID:yangchaojiang,项目名称:yjPlay,代码行数:9,代码来源:ImaAdsLoader.java

示例4: loadStartingUrl

import android.webkit.WebView; //导入方法依赖的package包/类
private void loadStartingUrl(String url)
{
  Log.i(LOG_TAG, "loadStartingUrl(" + url + ") <start>");
  final WebView webView = initializeAUTWebView();
  webView.loadUrl(url);
  webView.setVisibility(View.VISIBLE);
  webView.requestFocus(View.FOCUS_DOWN);
  m_toolbarRefreshButton.setEnabled(true);
  Log.i(LOG_TAG, "loadStartingUrl(" + url + ") <end>");
}
 
开发者ID:SOASTA,项目名称:touchtestweb-android,代码行数:11,代码来源:MainActivity.java

示例5: onCreate

import android.webkit.WebView; //导入方法依赖的package包/类
/**
 * Called when the activity is first created. Set the web view layout and
 * get the title and file to be displayed.
 * 
 * @param savedInstanceState
 *            Is used to save the state of the created Activity.
 * 
 * @author Yuriy Stanchev
 * 
 * @email [email protected]
 * 
 * @date 11 Mar 2012
 */
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);

	Intent intent = getIntent();
	Bundle extras = intent.getExtras();

	String title = (String) extras.get("title");
	String file = (String) extras.get("file");

	setContentView(R.layout.about);

	setTitle(title);

	WebView view = (WebView) findViewById(R.id.web);

	view.setFocusable(true);
	view.setFocusableInTouchMode(true);
	view.requestFocus();
	view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
	view.loadUrl(file);
	// Initialize the databases for the AIs.
	// Intent AIDBInitialization = new Intent(getApplicationContext(),
	// AIDBInitialization.class);
	// startActivity(AIDBInitialization);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:40,代码来源:AboutActivity.java

示例6: initView

import android.webkit.WebView; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void initView() {
    webView = (WebView) findViewById(R.id.webView);
    setTitle("关于(V"+getVersionName(this)+")");

    settings = webView.getSettings();
    settings.setJavaScriptEnabled(true); //如果访问的页面中有Javascript,则WebView必须设置支持Javascript
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setSupportZoom(true); //支持缩放
    settings.setBuiltInZoomControls(true); //支持手势缩放
    settings.setDisplayZoomControls(false); //是否显示缩放按钮

    // >= 19(SDK4.4)启动硬件加速,否则启动软件加速
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
        settings.setLoadsImagesAutomatically(true); //支持自动加载图片
    } else {
        webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
        settings.setLoadsImagesAutomatically(false);
    }

    settings.setUseWideViewPort(true); //将图片调整到适合WebView的大小
    settings.setLoadWithOverviewMode(true); //自适应屏幕
    settings.setDomStorageEnabled(true);
    settings.setSaveFormData(true);
    settings.setSupportMultipleWindows(true);
    settings.setAppCacheEnabled(true);
    settings.setCacheMode(WebSettings.LOAD_DEFAULT); //优先使用缓存

    webView.setHorizontalScrollbarOverlay(true);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setOverScrollMode(View.OVER_SCROLL_NEVER); // 取消WebView中滚动或拖动到顶部、底部时的阴影
    webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); // 取消滚动条白边效果
    webView.requestFocus();

    webView.loadUrl("file:///android_asset/about.html");
    webView.setWebViewClient(new WebViewClient() {
        @Override
        public boolean shouldOverrideUrlLoading(WebView view, String url) {
            view.loadUrl(url);
            return true;
        }
    });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:45,代码来源:AboutActivity.java


注:本文中的android.webkit.WebView.requestFocus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。