Java Code Examples for android.webkit.WebView#setVerticalScrollBarEnabled()

The following examples show how to use android.webkit.WebView#setVerticalScrollBarEnabled() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebDialog.java    From FacebookNewsfeedSample-Android with Apache License 2.0 6 votes vote down vote up
@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);

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    contentFrameLayout.addView(webViewContainer);
}
 
Example 2
Source File: KakaoWebViewDialog.java    From kakao-android-sdk-standalone with Apache License 2.0 6 votes vote down vote up
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    // TODO xml 설정으로 대체가 안되나?
    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, HttpRequestTask.KA_HEADER);
    webView.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    webView.setVisibility(View.INVISIBLE);
    webView.getSettings().setSavePassword(false);

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    contentFrameLayout.addView(webViewContainer);
}
 
Example 3
Source File: WebDialog.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
@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);
}
 
Example 4
Source File: GSIDWebViewActivity.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
public void initView() {
    mWebView = (WebView) findViewById(R.id.webview);

    mInjectJS = new InjectJS(mWebView);

    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.requestFocus();

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setSaveFormData(true);
    webSettings.setSupportZoom(true);
    webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);

    progressBar = findViewById(R.id.show_request_progress_bar);

}
 
Example 5
Source File: GSIDWebViewActivity.java    From iBeebo with GNU General Public License v3.0 6 votes vote down vote up
public void initView() {
    mWebView = (WebView) findViewById(R.id.webview);

    mInjectJS = new InjectJS(mWebView);

    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
    mWebView.requestFocus();

    WebSettings webSettings = mWebView.getSettings();
    webSettings.setJavaScriptEnabled(true);
    webSettings.setBuiltInZoomControls(true);
    webSettings.setSaveFormData(true);
    webSettings.setSupportZoom(true);
    webSettings.setCacheMode(WebSettings.LOAD_NO_CACHE);

    progressBar = findViewById(R.id.show_request_progress_bar);

}
 
Example 6
Source File: ChatWindowView.java    From chat-window-android with MIT License 6 votes vote down vote up
@Override
public boolean onCreateWindow(WebView view, boolean isDialog,
                              boolean isUserGesture, Message resultMsg) {
    webViewPopup = new WebView(getContext());

    CookieManager cookieManager = CookieManager.getInstance();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        cookieManager.getInstance().setAcceptThirdPartyCookies(webViewPopup, true);
    }

    webViewPopup.setVerticalScrollBarEnabled(false);
    webViewPopup.setHorizontalScrollBarEnabled(false);
    webViewPopup.setWebViewClient(new LCWebViewClient());
    webViewPopup.getSettings().setJavaScriptEnabled(true);
    webViewPopup.getSettings().setSavePassword(false);
    webViewPopup.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT));
    addView(webViewPopup);
    WebView.WebViewTransport transport = (WebView.WebViewTransport) resultMsg.obj;
    transport.setWebView(webViewPopup);
    resultMsg.sendToTarget();

    return true;
}
 
Example 7
Source File: WebDialog.java    From KlyphMessenger with MIT License 6 votes vote down vote up
@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);

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
 
Example 8
Source File: WebDialog.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
@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);
}
 
Example 9
Source File: WebDialog.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 6 votes vote down vote up
@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);

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    contentFrameLayout.addView(webViewContainer);
}
 
Example 10
Source File: WebDialog.java    From HypFacebook with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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);

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    contentFrameLayout.addView(webViewContainer);
}
 
Example 11
Source File: WebDialog.java    From drupalfit with MIT License 6 votes vote down vote up
@SuppressLint("SetJavaScriptEnabled")
private void setUpWebView(int margin) {
    Log8.d();
    LinearLayout webViewContainer = new LinearLayout(getContext());
    webView = new WebView(getContext());
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(new DialogWebViewClient());
    //webView.setWebChromeClient(new WebChromeClient());

    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(0xCC000000);
    contentFrameLayout.addView(webViewContainer);
    Log8.d();
}
 
Example 12
Source File: InstagramDialog.java    From AndroidInstagram with Apache License 2.0 6 votes vote down vote up
private void setUpWebView() {
	mWebView = new WebView(getContext());
        
	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);
	
	mContent.addView(mWebView);
}
 
Example 13
Source File: WebViewInitializer.java    From FastWaiMai with MIT License 5 votes vote down vote up
/**
 * 初始化传入的webView
 */
@SuppressLint("SetJavaScriptEnabled")
@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN)
public WebView initialWebView(WebView webView){
	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;
}
 
Example 14
Source File: OAuthController.java    From twitter-kit-android with Apache License 2.0 5 votes vote down vote up
/**
 * Package private for testing.
 */
void setUpWebView(WebView webView, WebViewClient webViewClient, String url,
                  WebChromeClient webChromeClient) {
    final WebSettings webSettings = webView.getSettings();
    webSettings.setAllowFileAccess(false);
    webSettings.setJavaScriptEnabled(false);
    webSettings.setSaveFormData(false);
    webView.setVerticalScrollBarEnabled(false);
    webView.setHorizontalScrollBarEnabled(false);
    webView.setWebViewClient(webViewClient);
    webView.loadUrl(url);
    webView.setVisibility(View.INVISIBLE);
    webView.setWebChromeClient(webChromeClient);
}
 
Example 15
Source File: ClassicWebViewProvider.java    From focus-android with Mozilla Public License 2.0 4 votes vote down vote up
private static void setupView(WebView webView) {
    webView.setVerticalScrollBarEnabled(true);
    webView.setHorizontalScrollBarEnabled(true);
}
 
Example 16
Source File: WebViewFacebook.java    From aptoide-client with GNU General Public License v2.0 4 votes vote down vote up
@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		//Aptoide.getThemePicker().setAptoideTheme(this);
		setContentView(R.layout.webview_social);

		Bundle parameters = new Bundle();
//		parameters.putString("client_id", APP_ID);
		parameters.putString("type", "user_agent");
		parameters.putString("redirect_uri", REDIRECT_URI);
		url = OAUTH_ENDPOINT + "?" + encodeUrl(parameters);
//		Log.d(this.getClass().getName(), "url: " + url);

		waitingText = (TextView) findViewById(R.id.waiting_text);
		waitingProgress = (ProgressBar) findViewById(R.id.waiting_bar);

		webView = (WebView) findViewById(R.id.webview);
		webView.getSettings().setJavaScriptEnabled(true);
		webView.setVerticalScrollBarEnabled(false);
		webView.setHorizontalScrollBarEnabled(false);
		webView.setWebViewClient(new FbWebViewClient());

		webView.setWebChromeClient(new WebChromeClient() {
			public void onProgressChanged(WebView view, int progress) {
				setProgress(progress * 100);

				if (progress == 100) {
					waitingText.setVisibility(View.GONE);
					waitingProgress.setVisibility(View.GONE);
				}
			}
		});

		webView.loadUrl(url);

		System.out.println("Debug: WebViewActionBar: " + getSupportActionBar());

		Toolbar mToolbar = (Toolbar) findViewById(R.id.toolbar);
		mToolbar.setCollapsible(false);

		setSupportActionBar(mToolbar);

		if (getSupportActionBar() != null) {
			getSupportActionBar().setTitle("");
			getSupportActionBar().setHomeButtonEnabled(true);
			getSupportActionBar().setDisplayHomeAsUpEnabled(true);
		}

    }
 
Example 17
Source File: WebViewUtils.java    From BigApp_Discuz_Android with Apache License 2.0 4 votes vote down vote up
/**
     * webview 显示本地图片,自适应布局大小,图片可缩放
     *
     * @param mContext
     * @param webview
     * @param imageLocalUrl
     * @param isAdapterScreenWidth 是否自适应屏幕宽度
     * @param color                0-255
     */
    public static void showLocalImage(Context mContext, final WebView webview,
                                      final String imageLocalUrl, int color, boolean isAdapterScreenWidth, boolean doubleClickEabled) {

        boolean fileExist = FileUtils.isExists(imageLocalUrl);

        if (fileExist) {
            String bgcolor = ColorUtils.toBrowserColor(color);

            ZogUtils.printLog(WebViewUtils.class, "bgcolor:" + bgcolor);

            String adapterScreenWidth = "";
            if (isAdapterScreenWidth) {
                adapterScreenWidth = " width:99.9%;";
            }


            String style =
                    "<style>" +
                            "* { margin:0; padding:0; background-color:" +
                            bgcolor +
                            ";  }" +

                            "img { " + adapterScreenWidth + " margin:0; padding:0; }" +

                            "div{" +
                            adapterScreenWidth +
//                            "     border: thin solid #F00;" +
                            "    margin:0; padding:0;" +
                            " }/*这里的width height 大于图片的宽高*/" +

                            "table{ height:100%; width:100%; text-align:center;}" +

                            " </style>";


            String body = "    <body>" +
                    "        <div>" +
                    "            <table>" +
                    "                <tr>" +
                    "                    <td>" +
                    "                       <img src=\"file://" + imageLocalUrl + "\"" +
//                            "                                width=" + width +
                    "                               margin=" + 0 +
                    "                               padding=" + 0 +
//                    "                               height="+height+
                    "                           />" +
                    "                    </td>" +
                    "                </tr>" +
                    "            </table>" +
                    "        </div>" +
                    "    </body>" +
                    "";

            String data = style + body;

            webview.loadDataWithBaseURL("file://" + imageLocalUrl, data, "text/html", "utf-8", null);

            //webview.loadUrl(imageUrl);//直接显示网上图片

            webview.setVerticalScrollBarEnabled(false); // 取消Vertical ScrollBar显示
            webview.setHorizontalScrollBarEnabled(false); //取消Horizontal ScrollBar显示
            webview.getSettings().setBuiltInZoomControls(true); //显示放大缩小 controler
            webview.getSettings().setSupportZoom(true); //可以缩放
            setZoomControlGone(webview);//去掉zoom按钮

            if (doubleClickEabled) {//双击缩放
                webview.getSettings().setUseWideViewPort(true);
                webview.getSettings().setLoadWithOverviewMode(true);
            }
            webview.setSaveEnabled(true);


        }
    }
 
Example 18
Source File: NewsDetailActivity.java    From Zhihu with GNU General Public License v2.0 4 votes vote down vote up
private void setWebView(WebView mWebView) {
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
}
 
Example 19
Source File: WebDialog.java    From kognitivo with Apache License 2.0 4 votes vote down vote up
@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);
}
 
Example 20
Source File: LargePictureFragment.java    From iBeebo with GNU General Public License v3.0 4 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.gallery_large_layout, container, false);

    final WebView large = (WebView) view.findViewById(R.id.large);
    large.setBackgroundColor(getResources().getColor(R.color.transparent));
    large.setVisibility(View.INVISIBLE);
    large.setOverScrollMode(View.OVER_SCROLL_NEVER);

    if (SettingUtils.allowClickToCloseGallery()) {
        large.setOnTouchListener(new LargeOnTouchListener(large));
    }

    LongClickListener longClickListener = ((BigPicContainerFragment) getParentFragment()).getLongClickListener();
    large.setOnLongClickListener(longClickListener);

    final String path = getArguments().getString("path");

    large.getSettings().setJavaScriptEnabled(true);
    large.getSettings().setUseWideViewPort(true);
    large.getSettings().setLoadWithOverviewMode(true);
    large.getSettings().setBuiltInZoomControls(true);
    large.getSettings().setDisplayZoomControls(false);

    large.setVerticalScrollBarEnabled(false);
    large.setHorizontalScrollBarEnabled(false);
    large.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    boolean animateIn = getArguments().getBoolean("animationIn");

    if (animateIn) {
        showContent(path, large);
    } else {
        /**
         * webview will influence other imageview animation performance
         */
        new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
            @Override
            public void run() {
                showContent(path, large);
            }
        }, GeneralPictureFragment.ANIMATION_DURATION + 300);
    }

    return view;
}