android.webkit.WebView#setScrollbarFadingEnabled ( )源码实例Demo

下面列出了android.webkit.WebView#setScrollbarFadingEnabled ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Android_Skin_2.0   文件: WebInitCompat.java
@Override
public void setDefaultAttr(WebView view) {
	// 去除滚动条白色背景,必须在代码里面添加才有效
	view.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
	view.setScrollbarFadingEnabled(true);
	view.setDrawingCacheEnabled(true);
	view.setLongClickable(true);
	view.setBackgroundResource(android.R.color.transparent);
	view.setBackgroundColor(Color.TRANSPARENT);
	view.getBackground().setAlpha(0);
	view.setFocusable(true);
	view.setFocusableInTouchMode(true);
}
 
源代码2 项目: ToGoZip   文件: AboutDialogPreference.java
private static WebView setAboutText(Context context, WebView wv) {
    final WebSettings settings = wv.getSettings();

    // Fix for "Wrong charset in serbian translations" https://github.com/k3b/LocationMapViewer/issues/5
    // (for android 2.2) see http://stackoverflow.com/questions/4933069/android-webview-with-garbled-utf-8-characters
    settings.setDefaultTextEncodingName("utf-8");
    settings.setBuiltInZoomControls(true);

    String html = context.getResources().getString(R.string.about_content); // "<html><body>some <b>html</b> here</body></html>";

    final String versionName = GuiUtil.getAppVersionName(context);
    if (versionName != null) {
        html = html.replace("$versionName$", versionName);
    }

    html = html.replace("$translate$",
            context.getText(R.string.about_translate));
    html = html.replace("$about$",
            context.getText(R.string.about_content_about));

    // Fix for "Wrong charset in serbian translations" https://github.com/k3b/LocationMapViewer/issues/5
    // (for android 4.x) see http://stackoverflow.com/questions/4933069/android-webview-with-garbled-utf-8-characters
    wv.loadData(html, "text/html; charset=utf-8", "UTF-8");
    wv.setVerticalScrollBarEnabled(true);

    wv.setScrollBarStyle(View.SCROLLBARS_OUTSIDE_OVERLAY);
    wv.setScrollbarFadingEnabled(false);
    return wv;
}
 
源代码3 项目: Xndroid   文件: LightningView.java
public LightningView(@NonNull Activity activity, @Nullable String url, boolean isIncognito) {
    BrowserApp.getAppComponent().inject(this);
    mActivity = activity;
    mUIController = (UIController) activity;
    mWebView = new WebView(activity);
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
        mWebView.setId(View.generateViewId());
    }
    mIsIncognitoTab = isIncognito;
    mTitle = new LightningViewTitle(activity);

    sMaxFling = ViewConfiguration.get(activity).getScaledMaximumFlingVelocity();

    mWebView.setDrawingCacheBackgroundColor(Color.WHITE);
    mWebView.setFocusableInTouchMode(true);
    mWebView.setFocusable(true);
    mWebView.setDrawingCacheEnabled(false);
    mWebView.setWillNotCacheDrawing(true);
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
        //noinspection deprecation
        mWebView.setAnimationCacheEnabled(false);
        //noinspection deprecation
        mWebView.setAlwaysDrawnWithCacheEnabled(false);
    }
    mWebView.setBackgroundColor(Color.WHITE);

    mWebView.setScrollbarFadingEnabled(true);
    mWebView.setSaveEnabled(true);
    mWebView.setNetworkAvailable(true);
    mWebView.setWebChromeClient(new LightningChromeClient(activity, this));
    mWebView.setWebViewClient(new LightningWebClient(activity, this));
    mWebView.setDownloadListener(new LightningDownloadListener(activity));
    mGestureDetector = new GestureDetector(activity, new CustomGestureListener());
    mWebView.setOnTouchListener(new TouchListener());
    sDefaultUserAgent = mWebView.getSettings().getUserAgentString();
    initializeSettings();
    initializePreferences(activity);

    if (url != null) {
        if (!url.trim().isEmpty()) {
            mWebView.loadUrl(url, mRequestHeaders);
        } else {
            // don't load anything, the user is looking for a blank tab
        }
    } else {
        loadHomepage();
    }
}
 
源代码4 项目: Overchan-Android   文件: CompatibilityImpl.java
@TargetApi(Build.VERSION_CODES.ECLAIR)
public static void setScrollbarFadingEnabled(WebView webView, boolean fadeScrollbars) {
    webView.setScrollbarFadingEnabled(fadeScrollbars);
}
 
源代码5 项目: JumpGo   文件: LightningView.java
public LightningView(@NonNull Activity activity, @Nullable String url, boolean isIncognito) {
    BrowserApp.getAppComponent().inject(this);
    mActivity = activity;
    mUIController = (UIController) activity;
    mWebView = new WebView(activity);
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN) {
        mWebView.setId(View.generateViewId());
    }
    mIsIncognitoTab = isIncognito;
    mTitle = new LightningViewTitle(activity);

    sMaxFling = ViewConfiguration.get(activity).getScaledMaximumFlingVelocity();

    mWebView.setDrawingCacheBackgroundColor(Color.WHITE);
    mWebView.setFocusableInTouchMode(true);
    mWebView.setFocusable(true);
    mWebView.setDrawingCacheEnabled(false);
    mWebView.setWillNotCacheDrawing(true);
    if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.LOLLIPOP_MR1) {
        //noinspection deprecation
        mWebView.setAnimationCacheEnabled(false);
        //noinspection deprecation
        mWebView.setAlwaysDrawnWithCacheEnabled(false);
    }
    mWebView.setBackgroundColor(Color.WHITE);

    mWebView.setScrollbarFadingEnabled(true);
    mWebView.setSaveEnabled(true);
    mWebView.setNetworkAvailable(true);
    mWebView.setWebChromeClient(new LightningChromeClient(activity, this));
    mLightningWebClient = new LightningWebClient(activity, this);
    mWebView.setWebViewClient(mLightningWebClient);
    mWebView.setDownloadListener(new LightningDownloadListener(activity));
    mGestureDetector = new GestureDetector(activity, new CustomGestureListener());
    mWebView.setOnTouchListener(new TouchListener());
    sDefaultUserAgent = mWebView.getSettings().getUserAgentString();
    initializeSettings();
    initializePreferences(activity);

    if (url != null) {
        if (!url.trim().isEmpty()) {
            mWebView.loadUrl(url, mRequestHeaders);
        } else {
            // don't load anything, the user is looking for a blank tab
        }
    } else {
        loadHomepage();
    }
}