在带有 android studio 的 java 中,我通过添加以下代码来实现这一点:
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setLoadWithOverviewMode(true);
webView.getSettings().setUseWideViewPort(true);
webView.getSettings().setSupportZoom(true);
webView.getSettings().setBuiltInZoomControls(true);
webView.getSettings().setDisplayZoomControls(false);
webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
webView.setScrollbarFadingEnabled(false);
但我不知道如何在 React-Native 中做到这一点,我尝试了一些 css 风格,但没有成功。
这是我在 React 中的 webview:
<WebView
ref="WebView"
scalesPageToFit={true}
onLoadStart={this.onLoadStart}
onLoadEnd={this.onLoadEnd}
source = {{ uri:this.props.navigation.getParam('main_url',
'https://xxxx.xxx/')}}
style={{backgroundColor: 'transparent',width: '100%'}}
/>:null}
茅侃侃
慕的地6264312
相关分类