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

The following examples show how to use android.webkit.WebView#setOverScrollMode() . 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: WhatsNewPopup.java    From arcusandroid with Apache License 2.0 6 votes vote down vote up
@Override
public void onResume() {
    super.onResume();

    webview = (WebView) getView().findViewById(R.id.whatsnew_webview);
    webview.getSettings().setJavaScriptEnabled(true);
    webview.getSettings().setAllowUniversalAccessFromFileURLs(true);    // Prevent CORS issues on page resources
    webview.setVerticalFadingEdgeEnabled(false);    // Get rid of overscroll glow
    webview.setOverScrollMode(View.OVER_SCROLL_NEVER);      // Get rid of overscroll effect
    webview.setWebViewClient(new WebViewClient(){
             @Override
             public boolean shouldOverrideUrlLoading(WebView view, String url) {
                 Uri uri = Uri.parse(url);
                 ActivityUtils.launchUrl(uri);
                 return true;
             }
         }
    );
    webview.loadUrl(whatsNewUrl);
}
 
Example 2
Source File: MainActivity.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    webView = (WebView) findViewById(R.id.webview);
    webView.getSettings().setJavaScriptEnabled(true);
    webView.setOverScrollMode(View.OVER_SCROLL_ALWAYS);
    webView.addJavascriptInterface(new AndrodJs(),"bevent");
    webView.getSettings().setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    //参数三:mimeType
    webView.loadDataWithBaseURL("", content, "text/html", "utf-8", null);
}
 
Example 3
Source File: PullToNextView.java    From Android-PullToNextLayout with Apache License 2.0 5 votes vote down vote up
public void a(Object o) {


        if (o instanceof ViewGroup) {

            ViewGroup vp = (ViewGroup) o;


            if (o instanceof ScrollView) {
                mScrollView = (ScrollView) o;
                mScrollView.setOverScrollMode(OVER_SCROLL_NEVER);
            } else if (o instanceof WebView) {
                mWebView = (WebView) o;
                mWebView.setOverScrollMode(OVER_SCROLL_NEVER);
            }


            for (int i = 0; i < vp.getChildCount(); i++) {


                a(vp.getChildAt(i));
            }
        }


    }
 
Example 4
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;
}
 
Example 5
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;
}