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


Java WebView.setHorizontalScrollBarEnabled方法代碼示例

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


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

示例1: init

import android.webkit.WebView; //導入方法依賴的package包/類
private void init(){
    LinearLayout layout = (LinearLayout) findViewById(R.id.Download_layout);
    layout.setVisibility(View.GONE);

    Intent intent = getIntent();
    body = intent.getStringExtra("body");
    title = intent.getStringExtra("title");
    contentView = (WebView) findViewById(R.id.content_webview);
    contentView.setHorizontalScrollBarEnabled(false);//水平不顯示
    contentView.setVerticalScrollBarEnabled(false); //垂直不顯示

    contentView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            return (event.getAction() == MotionEvent.ACTION_MOVE);
        }
    });
    contentView.setWebViewClient(new WebViewClient());

    topImage = (ImageView) findViewById(R.id.top_image);
    topTitle = (TextView) findViewById(R.id.top_titlt);
    topSource = (TextView) findViewById(R.id.top_source);
}
 
開發者ID:ChenTianSaber,項目名稱:DailyZhiHu,代碼行數:24,代碼來源:DownloadDetaiContentActivity.java

示例2: setUpWebView

import android.webkit.WebView; //導入方法依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    LinearLayout webViewContainer = new LinearLayout(getContext());
    webView = new WebView(getContext());
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(new DialogWebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);
    webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    webView.setVisibility(View.INVISIBLE);
    webView.getSettings().setSavePassword(false);
    webView.getSettings().setSaveFormData(false);

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
 
開發者ID:MobileDev418,項目名稱:AndroidBackendlessChat,代碼行數:21,代碼來源:WebDialog.java

示例3: createWebView

import android.webkit.WebView; //導入方法依賴的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

示例4: init

import android.webkit.WebView; //導入方法依賴的package包/類
private void init(){

        Intent intent = getIntent();
        contentId = intent.getStringExtra("contentId");
        contentView = (WebView) findViewById(R.id.content_webview);
        contentView.setHorizontalScrollBarEnabled(false);//水平不顯示
        contentView.setVerticalScrollBarEnabled(false); //垂直不顯示

        contentView.setOnTouchListener(new View.OnTouchListener() {
            @Override
            public boolean onTouch(View v, MotionEvent event) {
                return (event.getAction() == MotionEvent.ACTION_MOVE);
            }
        });
        contentView.setWebViewClient(new WebViewClient());

        topImage = (ImageView) findViewById(R.id.top_image);
        topTitle = (TextView) findViewById(R.id.top_titlt);
        topSource = (TextView) findViewById(R.id.top_source);
    }
 
開發者ID:ChenTianSaber,項目名稱:DailyZhiHu,代碼行數:21,代碼來源:DetaiContentActivity.java

示例5: setUpWebView

import android.webkit.WebView; //導入方法依賴的package包/類
private void setUpWebView() {
    mSpinner = new ProgressDialog(this);

    mSpinner.requestWindowFeature(Window.FEATURE_NO_TITLE);
    mSpinner.setMessage("Loading...");

    mWebView = new WebView(this);

    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setWebViewClient(new InstagramWebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(mAuthUrl);
    mWebView.setLayoutParams(FILL);

    WebSettings webSettings = mWebView.getSettings();

    webSettings.setSavePassword(false);
    webSettings.setSaveFormData(false);
    clearCache();


    addContentView(mWebView,FILL);
}
 
開發者ID:inceleb,項目名稱:InstagramManager-Android,代碼行數:25,代碼來源:LoginActivity.java

示例6: setUpWebView

import android.webkit.WebView; //導入方法依賴的package包/類
/**
 * Creating webview for instagram dialog login
 */

private void setUpWebView() {
  mWebView = new WebView(getContext());
  mWebView.setVerticalScrollBarEnabled(false);
  mWebView.setHorizontalScrollBarEnabled(false);
  mWebView.setWebViewClient(new OAuthWebViewClient());
  mWebView.getSettings().setJavaScriptEnabled(true);
  mWebView.loadUrl(mUrl);
  mWebView.setLayoutParams(FILL);
  mContent.addView(mWebView);
}
 
開發者ID:mukeshsolanki,項目名稱:social-login-helper,代碼行數:15,代碼來源:InstagramDialog.java

示例7: initSetting

import android.webkit.WebView; //導入方法依賴的package包/類
@SuppressLint({"JavascriptInterface"})
public void initSetting(WebView webView, Context context) {
    webView.getSettings().setUseWideViewPort(true);
    webView.getSettings().setSupportZoom(true);
    webView.getSettings().setBuiltInZoomControls(true);
    webView.getSettings().setUserAgentString(LetvUtils.createUA(webView.getSettings().getUserAgentString()));
    webView.setVerticalScrollBarEnabled(true);
    webView.setHorizontalScrollBarEnabled(true);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.getSettings().setDomStorageEnabled(true);
    webView.addJavascriptInterface(new GetShareDesc(), "getShareDesc");
}
 
開發者ID:JackChan1999,項目名稱:letv,代碼行數:13,代碼來源:LetvBaseWebViewActivity.java

示例8: onCreate

import android.webkit.WebView; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@SuppressLint("SetJavaScriptEnabled")
@Override
/**
 * When the dialog is created, we add the webview and load the authorize url.
 */
protected void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	requestWindowFeature(Window.FEATURE_NO_TITLE);
	
	mProgress = new ProgressDialog(getContext());
	mProgress.requestWindowFeature(Window.FEATURE_NO_TITLE);
	mProgress.setMessage("Loading...");
	
	mLayout = new LinearLayout(getContext());
	mLayout.setOrientation(LinearLayout.VERTICAL);

	mWebView = new WebView(getContext());
	mWebView.setVerticalScrollBarEnabled(false);
	mWebView.setHorizontalScrollBarEnabled(false);
	//mWebView.getSettings().setSupportZoom(false);
	mWebView.setLayoutParams(MATCH);
	mWebView.getSettings().setJavaScriptEnabled(true);

	mWebView.setWebViewClient(new OAuthWebViewClient());
       mWebView.setWebChromeClient(new WebChromeClient());
       
       mWebView.loadUrl(mReq.getLocationUri());
       mLayout.addView(mWebView);
       
       Display display = getWindow().getWindowManager().getDefaultDisplay();
	addContentView(mLayout, new FrameLayout.LayoutParams(display.getWidth() - 20, display.getHeight() - 20));
	CookieSyncManager.createInstance(getContext());
	CookieManager cookieManager = CookieManager.getInstance();
	cookieManager.removeAllCookie();
	
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:39,代碼來源:OAuthDialog.java

示例9: setUpWebView

import android.webkit.WebView; //導入方法依賴的package包/類
private void setUpWebView() {
    mWebView = new WebView(getContext());

    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setWebViewClient(new TwitterWebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(mUrl);
    mWebView.setLayoutParams(FILL);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.addJavascriptInterface(new MyJavaScriptInterface(), "HTMLOUT");

    mContent.addView(mWebView);
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:15,代碼來源:TwitterDialog.java

示例10: setUpWebView

import android.webkit.WebView; //導入方法依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView() {
    mWebView = new WebView(getContext());
    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setWebViewClient(new FoursquareDialog.FoursquareWebViewClient());
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.loadUrl(mUrl);
    mWebView.setLayoutParams(FILL);
    mContent.addView(mWebView);
}
 
開發者ID:Dnet3,項目名稱:CustomAndroidOneSheeld,代碼行數:12,代碼來源:FoursquareDialog.java

示例11: onCreate

import android.webkit.WebView; //導入方法依賴的package包/類
@SuppressLint({"SetJavaScriptEnabled"})
@Override
public void onCreate() {
    super.onCreate();

    mWebView = new WebView(this);
    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.setBackgroundColor(Color.TRANSPARENT);
    mWebView.getSettings().setJavaScriptEnabled(true);
    {
        mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);

        mHideParams = newLayoutParams(1);

        final DisplayMetrics metrics = getResources().getDisplayMetrics();
        final int min = Math.min(metrics.heightPixels, metrics.widthPixels);

        mPlayerSize = (int) (min / metrics.density);

        mParams = newLayoutParams(min);
        mParams.gravity = Gravity.CENTER_HORIZONTAL | Gravity.TOP;
        mParams.y = getTopY(metrics);
    }
    final IntentFilter filter = new IntentFilter();
    filter.addAction(ServiceAction.STOP);
    filter.addAction(ServiceAction.SHOW);
    filter.addAction(ServiceAction.HIDE);

    LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver = newBroadcastReceiver(), filter);
}
 
開發者ID:RollnCode,項目名稱:BackTube,代碼行數:32,代碼來源:PlayerService.java

示例12: showWhatsNewBox

import android.webkit.WebView; //導入方法依賴的package包/類
public void showWhatsNewBox()	{
	AlertDialog.Builder blder = new AlertDialog.Builder(this);
	blder.setIcon(R.drawable.icon);
	blder.setTitle(getString(R.string.whats_new));
       LayoutInflater factory = LayoutInflater.from(this);
       View vWhatsNew = factory.inflate(R.layout.whats_new, null);
       WebView webviewWhatsNew = (WebView)vWhatsNew.findViewById(R.id.webviewWhatsNew);
       webviewWhatsNew.setVerticalScrollBarEnabled(true);
       webviewWhatsNew.setHorizontalScrollBarEnabled(true);
    webviewWhatsNew.getSettings().setBuiltInZoomControls(true);
       Locale l = Locale.getDefault();  
    String strLanguage = String.format("%s-%s", l.getLanguage(), l.getCountry());
    String strIndexAddr;
    if (strLanguage.equals("zh-CN") || strLanguage.equals("zh-SG"))	{
    	strIndexAddr = "file:///android_asset/zh-CN/" + WHATS_NEW_FILE_PATH + ".html";
    } else if (strLanguage.equals("zh-TW") || strLanguage.equals("zh-HK"))	{
	    	strIndexAddr = "file:///android_asset/zh-TW/" + WHATS_NEW_FILE_PATH + ".html";
    } else	{
    	strIndexAddr = "file:///android_asset/en/" + WHATS_NEW_FILE_PATH + ".html";
    	strLanguage = "en";
    }
    webviewWhatsNew.loadUrl(strIndexAddr);
	blder.setView(vWhatsNew);
	blder.setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {
		
		@Override
		public void onClick(DialogInterface dialog, int which) {
		}
	});
	blder.setCancelable(false);
	AlertDialog alertWhatsnewDlg = blder.create();
	alertWhatsnewDlg.show();
}
 
開發者ID:woshiwpa,項目名稱:SmartMath,代碼行數:34,代碼來源:ActivitySmartCalc.java

示例13: 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

示例14: setUpWebView

import android.webkit.WebView; //導入方法依賴的package包/類
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    LinearLayout webViewContainer = new LinearLayout(getContext());
    webView = new WebView(getContext().getApplicationContext()) {
        /* Prevent NPE on Motorola 2.2 devices
         * See https://groups.google.com/forum/?fromgroups=#!topic/android-developers/ktbwY2gtLKQ
         */
        @Override
        public void onWindowFocusChanged(boolean hasWindowFocus) {
            try {
                super.onWindowFocusChanged(hasWindowFocus);
            } catch (NullPointerException e) {
            }
        }
    };
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(new DialogWebViewClient());
    webView.getSettings().setJavaScriptEnabled(true);
    webView.loadUrl(url);
    webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    webView.setVisibility(View.INVISIBLE);
    webView.getSettings().setSavePassword(false);
    webView.getSettings().setSaveFormData(false);
    webView.setFocusable(true);
    webView.setFocusableInTouchMode(true);
    webView.setOnTouchListener(new View.OnTouchListener() {
        @Override
        public boolean onTouch(View v, MotionEvent event) {
            if (!v.hasFocus())
            {
                v.requestFocus();
            }
            return false;
        }
    });

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
 
開發者ID:eviltnan,項目名稱:kognitivo,代碼行數:44,代碼來源:WebDialog.java

示例15: onCreate

import android.webkit.WebView; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_moodle);
    Toolbar toolbar = (Toolbar) findViewById(R.id.tool_bar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    webView = (WebView) findViewById(R.id.web_moodle);
    webSettings = webView.getSettings();
    webSettings.setAppCacheEnabled(true);
    //webSettings.setCacheMode(webSettings.LOAD_CACHE_ELSE_NETWORK);
    webSettings.setJavaScriptEnabled(true);
    webSettings.setLoadWithOverviewMode(true);
    webSettings.setAllowFileAccess(true);
    webView.setVerticalScrollBarEnabled(false);
    webView.getSettings().setDomStorageEnabled(true);
    webView.setHorizontalScrollBarEnabled(false);
    CookieManager.getInstance().setAcceptThirdPartyCookies(webView, true);
    CookieManager.getInstance().setAcceptCookie(true);
    //final SharedPreferences profile = getSharedPreferences("userdata", 0);
    webView.setWebViewClient(new PQClient());
    webView.setWebChromeClient(new PQChromeClient());
    //if SDK version is greater of 19 then activate hardware acceleration otherwise activate software acceleration
    if (Build.VERSION.SDK_INT >= 19) {
        webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
    }
    else if(Build.VERSION.SDK_INT >=11 && Build.VERSION.SDK_INT < 19) {
        webView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
    }

    webView.loadUrl("http://moodle.coep.org.in/moodle/login/index.php");
    webView.setDownloadListener(new DownloadListener() {

        @Override
        public void onDownloadStart(String url, String userAgent,
                                    String contentDisposition, String mimetype,
                                    long contentLength) {
            try {
                DownloadManager.Request request = new DownloadManager.Request(
                        Uri.parse(url));
            /* Let's have some Cookies !!!*/
                String cookies = CookieManager.getInstance().getCookie(url);
                request.addRequestHeader("cookie", cookies);
                //Yummy !!
                request.allowScanningByMediaScanner();
                request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Notify client once download is completed!
                final String filename = URLUtil.guessFileName(url, contentDisposition, mimetype);
                request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, filename);
                DownloadManager dm = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
                dm.enqueue(request);
                makeText(getApplicationContext(), "Downloading File", //To notify the Client that the file is being downloaded
                        Toast.LENGTH_LONG).show();
            }
            catch(SecurityException e)
            {
                Toast.makeText(getApplicationContext(),"Please grant the storage permission !",Toast.LENGTH_LONG).show();
            }

        }
    });
}
 
開發者ID:ashutoshbsathe,項目名稱:COEP-Moodle-via-Webview,代碼行數:62,代碼來源:Moodle.java


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