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

The following examples show how to use android.webkit.WebView#setHorizontalScrollBarEnabled() . 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: WebViewActivity.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);
    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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
Source File: WebDialog.java    From Abelana-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);
    webView.getSettings().setSaveFormData(false);

    webViewContainer.setPadding(margin, margin, margin, margin);
    webViewContainer.addView(webView);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
 
Example 10
Source File: WebDataActivity.java    From YCCustomText with Apache License 2.0 6 votes vote down vote up
public void initWebView(String data) {
        WebView mWebView = findViewById(R.id.showdiarys);
        WebSettings settings = mWebView.getSettings();

        //settings.setUseWideViewPort(true);//调整到适合webview的大小,不过尽量不要用,有些手机有问题
        settings.setLoadWithOverviewMode(true);//设置WebView是否使用预览模式加载界面。
        mWebView.setVerticalScrollBarEnabled(false);//不能垂直滑动
        mWebView.setHorizontalScrollBarEnabled(false);//不能水平滑动
        settings.setTextSize(WebSettings.TextSize.NORMAL);//通过设置WebSettings,改变HTML中文字的大小
        settings.setJavaScriptCanOpenWindowsAutomatically(true);//支持通过JS打开新窗口
        //设置WebView属性,能够执行Javascript脚本
        mWebView.getSettings().setJavaScriptEnabled(true);//设置js可用
        mWebView.setWebViewClient(new WebViewClient());
        mWebView.addJavascriptInterface(new AndroidJavaScript(getApplication()), "android");//设置js接口
        settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);//支持内容重新布局


/******  22222222  ***********************************************************************/
        data = "</Div><head><style>img{ width:100% !important;}</style></head>" + data;//给图片设置一个样式,宽满屏
/******  2222222222  ***********************************************************************/

        mWebView.loadDataWithBaseURL(null, data, "text/html", "utf-8", null);
    }
 
Example 11
Source File: WebTextActivity.java    From YCCustomText with Apache License 2.0 6 votes vote down vote up
public void initWebView(String data) {
    WebView mWebView = findViewById(R.id.showdiarys);
    WebSettings settings = mWebView.getSettings();

    //settings.setUseWideViewPort(true);//调整到适合webview的大小,不过尽量不要用,有些手机有问题
    settings.setLoadWithOverviewMode(true);//设置WebView是否使用预览模式加载界面。
    mWebView.setVerticalScrollBarEnabled(false);//不能垂直滑动
    mWebView.setHorizontalScrollBarEnabled(false);//不能水平滑动
    settings.setTextSize(WebSettings.TextSize.NORMAL);//通过设置WebSettings,改变HTML中文字的大小
    settings.setJavaScriptCanOpenWindowsAutomatically(true);//支持通过JS打开新窗口
    //设置WebView属性,能够执行Javascript脚本
    mWebView.getSettings().setJavaScriptEnabled(true);//设置js可用
    mWebView.setWebViewClient(new WebViewClient());
    mWebView.addJavascriptInterface(new AndroidJavaScript(getApplication()), "android");//设置js接口
    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);//支持内容重新布局

    mWebView.loadUrl(data);
}
 
Example 12
Source File: WebDialog.java    From barterli_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);
    webViewContainer.setBackgroundColor(BACKGROUND_GRAY);
    contentFrameLayout.addView(webViewContainer);
}
 
Example 13
Source File: WebDialog.java    From facebooklogin 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);
    contentFrameLayout.addView(webViewContainer);
}
 
Example 14
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 15
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 16
Source File: InstagramDialog.java    From social-login-helper-Deprecated- with MIT License 5 votes vote down vote up
/**
 * 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);
}
 
Example 17
Source File: InformationDialogPreference.java    From masterpassword with GNU General Public License v3.0 5 votes vote down vote up
protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder builder) {
    WebView webview = new WebView(getContext());
    webview.setHorizontalScrollbarOverlay(true);
    webview.setHorizontalScrollBarEnabled(true);
    webview.loadDataWithBaseURL(null, addXmlUtf8Header(content), "text/html", null, null);
    builder.setTitle(getTitle()).setCancelable(false).setPositiveButton(android.R.string.ok, null).setView(webview);
    super.onPrepareDialogBuilder(builder);
}
 
Example 18
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 19
Source File: HomeNewsDetailActivity.java    From myapplication with Apache License 2.0 4 votes vote down vote up
private void setWebView(WebView mWebView) {
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.setVerticalScrollBarEnabled(false);
    mWebView.setHorizontalScrollBarEnabled(false);
}
 
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;
}