當前位置: 首頁>>代碼示例>>Java>>正文


Java WebSettings.setBuiltInZoomControls方法代碼示例

本文整理匯總了Java中android.webkit.WebSettings.setBuiltInZoomControls方法的典型用法代碼示例。如果您正苦於以下問題:Java WebSettings.setBuiltInZoomControls方法的具體用法?Java WebSettings.setBuiltInZoomControls怎麽用?Java WebSettings.setBuiltInZoomControls使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.webkit.WebSettings的用法示例。


在下文中一共展示了WebSettings.setBuiltInZoomControls方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initViews

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint({"SetJavaScriptEnabled"})
private void initViews() {
    this.mWebView.setVerticalScrollBarEnabled(false);
    this.mWebView.setHorizontalScrollBarEnabled(false);
    this.mWebView.setWebViewClient(new FbWebViewClient());
    this.mWebView.setWebChromeClient(this.mChromeClient);
    this.mWebView.clearFormData();
    WebSettings settings = this.mWebView.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.mWeakContext == null || this.mWeakContext.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.mWeakContext.get()).getApplicationContext().getDir("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.mWebView.clearView();
    this.mWebView.loadUrl(this.mUrl);
    this.mWebView.getSettings().setSavePassword(false);
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:27,代碼來源:PKDialog.java

示例2: init

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
private void init(Context context) {
    // 頂部顯示的進度條
    mProgressBar = new ProgressBar(context, null, android.R.attr.progressBarStyleHorizontal);
    mProgressBar.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 7, 0, 0));
    Drawable drawable = context.getResources().getDrawable(R.drawable.layer_web_progress_bar);
    mProgressBar.setProgressDrawable(drawable);
    addView(mProgressBar);

    WebSettings webSettings = this.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setSupportZoom(true);   // 是能放大縮小
    webSettings.setUseWideViewPort(true);
    webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setDisplayZoomControls(false);//隱藏
    webSettings.setDomStorageEnabled(true);
    webSettings.setSupportMultipleWindows(true);
    //webSettings.setUseWideViewPort(true);
    this.setWebViewClient(mWebViewClientBase);
    this.setWebChromeClient(mWebChromeClientBase);
    setDownloadListener(new DownloadListener());
    this.onResume();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:26,代碼來源:CustomWebView.java

示例3: initWidgets

import android.webkit.WebSettings; //導入方法依賴的package包/類
@Override
protected void initWidgets() {
    super.initWidgets();
    mBackImg = (ImageView) findViewById(R.id.kf5_return_img);
    mBackImg.setOnClickListener(this);
    mWebView = (WebView) findViewById(R.id.kf5_post_detail_content);
    mDetailTitle = (TextView) findViewById(R.id.kf5_post_detail_title);
    mDate = (TextView) findViewById(R.id.kf5_post_detail_date);
    WebSettings webSettings = mWebView.getSettings();
    webSettings.setBuiltInZoomControls(false);
    webSettings.setDomStorageEnabled(true);
    webSettings.setDatabaseEnabled(true);
    webSettings.setAppCacheEnabled(true);
    webSettings.setLoadsImagesAutomatically(true);
    webSettings.setPluginState(WebSettings.PluginState.ON);
    webSettings.setBuiltInZoomControls(false); //顯示放大縮小 controler
    webSettings.setSupportZoom(false); //可以縮放
    webSettings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    mWebView.setWebViewClient(new MyWebViewClient());
}
 
開發者ID:Zyj163,項目名稱:yyox,代碼行數:21,代碼來源:HelpCenterTypeDetailsActivity.java

示例4: initWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void initWebView() {
        WebSettings webSettings = webView.getSettings();
//        webSettings.setJavaScriptEnabled(true);

        webSettings.setUseWideViewPort(true); //將圖片調整到適合webview的大小
        webSettings.setLoadWithOverviewMode(true); // 縮放至屏幕的大小

        webSettings.setSupportZoom(true); //支持縮放,默認為true。是下麵那個的前提。
        webSettings.setBuiltInZoomControls(true); //設置內置的縮放控件。若為false,則該WebView不可縮放
        webSettings.setDisplayZoomControls(false); //隱藏原生的縮放控件

        webSettings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //關閉webview中緩存
        webSettings.setAllowFileAccess(true); //設置可以訪問文件
        webSettings.setJavaScriptCanOpenWindowsAutomatically(true); //支持通過JS打開新窗口
        webSettings.setLoadsImagesAutomatically(true); //支持自動加載圖片
        webSettings.setDefaultTextEncodingName("utf-8");//設置編碼格式

    }
 
開發者ID:DuanJiaNing,項目名稱:Musicoco,代碼行數:19,代碼來源:WebActivity.java

示例5: createWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
public WebView createWebView(WebView webView) {

    //WebView.setWebContentsDebuggingEnabled(true);
    //不能橫向滾動
    webView.setHorizontalScrollBarEnabled(false);
    //不能縱向滾動
    webView.setVerticalScrollBarEnabled(false);
    //允許截圖
    webView.setDrawingCacheEnabled(true);
    //屏蔽長按事件
    webView.setOnLongClickListener(new View.OnLongClickListener() {
        @Override
        public boolean onLongClick(View v) {
            return true;
        }
    });
    //初始化WebSettings
    final WebSettings settings = webView.getSettings();
    settings.setJavaScriptEnabled(true);
    final String ua = settings.getUserAgentString();
    settings.setUserAgentString(ua + "Latte");
    //隱藏縮放控件
    settings.setBuiltInZoomControls(false);
    settings.setDisplayZoomControls(false);
    //禁止縮放
    settings.setSupportZoom(false);
    //文件權限
    settings.setAllowFileAccess(true);
    settings.setAllowFileAccessFromFileURLs(true);
    settings.setAllowUniversalAccessFromFileURLs(true);
    settings.setAllowContentAccess(true);
    //緩存相關
    settings.setAppCacheEnabled(true);
    settings.setDomStorageEnabled(true);
    settings.setDatabaseEnabled(true);
    settings.setCacheMode(WebSettings.LOAD_DEFAULT);

    return webView;
}
 
開發者ID:remerber,項目名稱:FastEc,代碼行數:41,代碼來源:WebViewInitializer.java

示例6: setWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setWebView() {
        WebSettings ws = wvNewContent.getSettings();
        ws.setJavaScriptEnabled(true);  //支持js
        ws.setPluginState(WebSettings.PluginState.ON);//設置是否支持插件
        ws.setUseWideViewPort(false);  //將圖片調整到適合webview的大小
        ws.setSupportZoom(true);  //支持縮放
        ws.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN); //支持內容重新布局
        ws.supportMultipleWindows();  //多窗口
        ws.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK);  //關閉webview中緩存
//        cache模式有如下幾種:
//        LOAD_DEFAULT: 如果我們應用程序沒有設置任何cachemode, 這個是默認的cache方式。 加載一張網頁會檢查是否有cache,如果有並且沒有過期則使用本地cache,否則從網絡上獲取。
//        LOAD_CACHE_ELSE_NETWORK: 使用cache資源,即使過期了也使用,如果沒有cache才從網絡上獲取。
//        LOAD_NO_CACHE: 不使用cache 全部從網絡上獲取
//        LOAD_CACHE_ONLY:  隻使用cache上的內容
        ws.setAllowFileAccess(true);  //設置可以訪問文件
        ws.setNeedInitialFocus(true); //當webview調用requestFocus時為webview設置節點
        ws.setBuiltInZoomControls(true); //設置支持縮放
        ws.setJavaScriptCanOpenWindowsAutomatically(true); //支持通過JS打開新窗口
        ws.setLoadWithOverviewMode(true); // 縮放至屏幕的大小
        ws.setLoadsImagesAutomatically(true);  //支持自動加載圖片
    }
 
開發者ID:guxiaonian,項目名稱:MeiLa_GNN,代碼行數:22,代碼來源:GlobalWebViewActivity.java

示例7: initSettings

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void initSettings(){
    WebSettings webSettings = this.getSettings();

    webSettings.setJavaScriptEnabled(true);

    webSettings.setDomStorageEnabled(true);
    webSettings.setAllowFileAccess(true);
    webSettings.setUseWideViewPort(true);

    webSettings.setUseWideViewPort(true);
    webSettings.setLoadWithOverviewMode(true);

    webSettings.setSupportZoom(false);
    webSettings.setBuiltInZoomControls(false);
    webSettings.setDisplayZoomControls(false);

    webSettings.setDefaultTextEncodingName("UTF-8");

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        webSettings.setAllowFileAccessFromFileURLs(true);
        webSettings.setAllowUniversalAccessFromFileURLs(true);
    }
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
        CookieManager cookieManager = CookieManager.getInstance();
        cookieManager.setAcceptThirdPartyCookies(this,true);
    }
    setWebViewDefaultCacheMode();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        webSettings.setMixedContentMode(
                WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
    }
    setCachePath();

}
 
開發者ID:yale8848,項目名稱:CacheWebView,代碼行數:35,代碼來源:CacheWebView.java

示例8: b

import android.webkit.WebSettings; //導入方法依賴的package包/類
@SuppressLint({"SetJavaScriptEnabled"})
private void b() {
    this.i.setVerticalScrollBarEnabled(false);
    this.i.setHorizontalScrollBarEnabled(false);
    this.i.setWebViewClient(new FbWebViewClient());
    this.i.setWebChromeClient(this.mChromeClient);
    this.i.clearFormData();
    WebSettings settings = this.i.getSettings();
    settings.setSavePassword(false);
    settings.setSaveFormData(false);
    settings.setCacheMode(-1);
    settings.setNeedInitialFocus(false);
    settings.setBuiltInZoomControls(true);
    settings.setSupportZoom(true);
    settings.setRenderPriority(RenderPriority.HIGH);
    settings.setJavaScriptEnabled(true);
    if (!(this.c == null || this.c.get() == null)) {
        settings.setDatabaseEnabled(true);
        settings.setDatabasePath(((Context) this.c.get()).getApplicationContext().getDir
                ("databases", 0).getPath());
    }
    settings.setDomStorageEnabled(true);
    this.jsBridge.a(new JsListener(), "sdk_js_if");
    this.i.loadUrl(this.e);
    this.i.setLayoutParams(a);
    this.i.setVisibility(4);
    this.i.getSettings().setSavePassword(false);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:29,代碼來源:TDialog.java

示例9: setWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setWebView(@NonNull final String newsSrc) {
    if (newsWebView != null) {
        WebSettings settings = this.newsWebView.getSettings();
        settings.setUseWideViewPort(true);
        settings.setBuiltInZoomControls(true);
        settings.setLoadWithOverviewMode(true);
        this.newsWebView.loadUrl(newsSrc);
    }
}
 
開發者ID:ZafraniTechLLC,項目名稱:Companion-For-PUBG-Android,代碼行數:10,代碼來源:NewsDetailFragment.java

示例10: setDesktopMode

import android.webkit.WebSettings; //導入方法依賴的package包/類
/**
 * Force web sites to show their desktop versions
 * @param enabled false loads the mobile version
 */
public void setDesktopMode(boolean enabled) {
    WebSettings webSettings = getSettings();
    String newUserAgent;
    if (enabled)
        newUserAgent = webSettings.getUserAgentString().replace("Mobile", "eliboM").replace("Android", "diordnA");
    else
        newUserAgent = webSettings.getUserAgentString().replace("eliboM", "Mobile").replace("diordnA", "Android");
    webSettings.setUserAgentString(newUserAgent);
    webSettings.setUseWideViewPort(enabled);
    webSettings.setLoadWithOverviewMode(enabled);
    webSettings.setSupportZoom(enabled);
    webSettings.setBuiltInZoomControls(enabled);
}
 
開發者ID:vic797,項目名稱:prowebview,代碼行數:18,代碼來源:ProWebView.java

示例11: initWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void initWebView() {
        WebSettings webSettings = webView.getSettings();
        webSettings.setJavaScriptEnabled(true);
        webSettings.setBuiltInZoomControls(true);
        webView.setWebViewClient(new WebViewClient());
        webView.addJavascriptInterface(new AndroidAndJsInterface(), "Android");
//        webView.loadUrl("file:///android_asset/JavaAndJavaScriptCall.html");
        webView.loadUrl("file:///android_asset/readmode.html");
    }
 
開發者ID:wuhighway,項目名稱:DailyStudy,代碼行數:10,代碼來源:JavaAndH5Activity.java

示例12: setUpWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void setUpWebView() {
    WebSettings settings = mWebView.getSettings();
    settings.setUseWideViewPort(true);
    settings.setBuiltInZoomControls(true);
    settings.setLoadWithOverviewMode(true);
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setDomStorageEnabled(true);
    settings.setDisplayZoomControls(false);
    mWebView.setWebViewClient(new MyWebViewClient());
    mWebView.setWebChromeClient(new MyWebChromeClient());
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:13,代碼來源:EWebView.java

示例13: init

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void init() {
    WebSettings settings = getSettings();
    settings.setUseWideViewPort(true);
    settings.setBuiltInZoomControls(true);
    settings.setLoadWithOverviewMode(true);
    settings.setJavaScriptEnabled(true);
    settings.setJavaScriptCanOpenWindowsAutomatically(true);
    settings.setDomStorageEnabled(true);
    settings.setDisplayZoomControls(false);
    setWebViewClient(new WebViewClient());
    setWebChromeClient(new WebChromeClient());
}
 
開發者ID:hyb1996,項目名稱:Auto.js,代碼行數:13,代碼來源:JsWebView.java

示例14: initWebView

import android.webkit.WebSettings; //導入方法依賴的package包/類
private void initWebView() {
    WebSettings ws = mWebView.getSettings();
    // 網頁內容的寬度是否可大於WebView控件的寬度
    ws.setLoadWithOverviewMode(false);
    // 保存表單數據
    ws.setSaveFormData(true);
    // 是否應該支持使用其屏幕縮放控件和手勢縮放
    ws.setSupportZoom(true);
    ws.setBuiltInZoomControls(true);
    ws.setDisplayZoomControls(false);
    // 啟動應用緩存
    ws.setAppCacheEnabled(true);
    // 設置緩存模式
    ws.setCacheMode(WebSettings.LOAD_DEFAULT);
    // setDefaultZoom  api19被棄用
    // 設置此屬性,可任意比例縮放。
    ws.setUseWideViewPort(true);
    // 縮放比例 1
    mWebView.setInitialScale(1);
    // 告訴WebView啟用JavaScript執行。默認的是false。
    ws.setJavaScriptEnabled(true);
    //  頁麵加載好以後,再放開圖片
    ws.setBlockNetworkImage(false);
    // 使用localStorage則必須打開
    ws.setDomStorageEnabled(true);
    // 排版適應屏幕
    ws.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.NARROW_COLUMNS);
    // WebView是否支持多個窗口。
    ws.setSupportMultipleWindows(true);
    // webview從5.0開始默認不允許混合模式,https中不能加載http資源,需要設置開啟。
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        ws.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
    }
    /** 設置字體默認縮放大小(改變網頁字體大小,setTextSize  api14被棄用)*/
    ws.setTextZoom(100);
    mWebView.setWebViewClient(new MyWebViewClient());
    mWebView.setWebChromeClient(webChromeClient = new MyWebChromeClient());
    mWebView.loadUrl(url);
}
 
開發者ID:yangchong211,項目名稱:YCUtils,代碼行數:40,代碼來源:KnowledgeOtherFragment.java

示例15: setDiffFileSource

import android.webkit.WebSettings; //導入方法依賴的package包/類
public void setDiffFileSource(@NonNull String source, boolean wrap) {
    if (StringUtils.isBlank(source)) return;
    WebSettings settings = getSettings();
    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING);
    setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    settings.setSupportZoom(true);
    settings.setBuiltInZoomControls(true);
    settings.setDisplayZoomControls(false);
    String page = HtmlHelper.generateDiffHtml(source, AppUtils.isNightMode(),
            getCodeBackgroundColor(), wrap);
    loadPage(page);
}
 
開發者ID:ThirtyDegreesRay,項目名稱:OpenHub,代碼行數:13,代碼來源:CodeWebView.java


注:本文中的android.webkit.WebSettings.setBuiltInZoomControls方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。