FinestWebView自定义WebView 的使用

添加依赖

 compile 'com.thefinestartist:finestwebview:1.0.6'

在AndroidManifest.xml文件中注册activity和声明权限

<uses-permission android:name="android.permission.INTERNET" />

<activity
    android:name="com.thefinestartist.finestwebview.FinestWebViewActivity"
    android:configChanges="keyboardHidden|orientation|screenSize"
    android:screenOrientation="sensor"
    android:theme="@style/FinestWebViewTheme.Light" />

直接使用默认的WebVIew

new FinestWebView.Builder(activity).show(url);

自定义选项

1.主题

new FinestWebView.Builder(this)
          .theme(R.style.RedTheme)//修改主题
          .titleDefault("Bless This Stuff")
          .webViewBuiltInZoomControls(true)//使用内置控件 实现放大缩小功能
          .webViewDisplayZoomControls(true)
          .dividerHeight(0)
          .gradientDivider(false)
          .setCustomAnimations(R.anim.activity_open_enter, R.anim.activity_open_exit,
              R.anim.activity_close_enter, R.anim.activity_close_exit)//动画
          .injectJavaScript("javascript: document.getElementById('msg').innerHTML='Hello "
              + "TheFinestArtist"
              + "!';")
          .show("http://www.blessthisstuff.com");
 new FinestWebView.Builder(this).theme(R.style.FinestWebViewTheme)
          .titleDefault("Vimeo")
          .showUrl(false)
          .statusBarColorRes(R.color.bluePrimaryDark)
          .toolbarColorRes(R.color.bluePrimary)
          .titleColorRes(R.color.finestWhite)
          .urlColorRes(R.color.bluePrimaryLight)
          .iconDefaultColorRes(R.color.finestWhite)
          .progressBarColorRes(R.color.finestWhite)
          .stringResCopiedToClipboard(R.string.copied_to_clipboard)
          .stringResCopiedToClipboard(R.string.copied_to_clipboard)
          .stringResCopiedToClipboard(R.string.copied_to_clipboard)
          .showSwipeRefreshLayout(true)
          .swipeRefreshColorRes(R.color.bluePrimaryDark)
          .menuSelector(R.drawable.selector_light_theme)
          .menuTextGravity(Gravity.CENTER)
          .menuTextPaddingRightRes(R.dimen.defaultMenuTextPaddingLeft)
          .dividerHeight(0)
          .gradientDivider(false)
          .setCustomAnimations(R.anim.slide_up, R.anim.hold, R.anim.hold, R.anim.slide_down)
          .show("http://example.com");
new FinestWebView.Builder(this).theme(R.style.FinestWebViewTheme)
          .titleDefault("Dribbble")
          .toolbarScrollFlags(0)
          .statusBarColorRes(R.color.blackPrimaryDark)
          .toolbarColorRes(R.color.blackPrimary)
          .titleColorRes(R.color.finestWhite)
          .urlColorRes(R.color.blackPrimaryLight)
          .iconDefaultColorRes(R.color.finestWhite)
          .progressBarColorRes(R.color.finestWhite)
          .swipeRefreshColorRes(R.color.blackPrimaryDark)
          .menuSelector(R.drawable.selector_light_theme)
          .menuTextGravity(Gravity.CENTER_VERTICAL | Gravity.RIGHT)
          .menuTextPaddingRightRes(R.dimen.defaultMenuTextPaddingLeft)
          .dividerHeight(0)
          .gradientDivider(false)
          //                    .setCustomAnimations(R.anim.slide_up, R.anim.hold, R.anim.hold, R.anim.slide_down)
          .setCustomAnimations(R.anim.slide_left_in, R.anim.hold, R.anim.hold,
              R.anim.slide_right_out)
          //                    .setCustomAnimations(R.anim.fade_in_fast, R.anim.fade_out_medium, R.anim.fade_in_medium, R.anim.fade_out_fast)
          .disableIconBack(true)
          .disableIconClose(true)
          .disableIconForward(true)
          .disableIconMenu(true)
          .show("https://dribbble.com");
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值