當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。