我使用以下代码从我的应用程序中启动WebView
。我的整个应用程序使用带有左侧菜单的顶栏,但是当我运行此webview
顶栏和左侧菜单隐藏时。任何帮助将不胜感激。谢谢。
WebView webView = new WebView(this);
setContentView(webView);
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl(result.getText());
这是我的xml文件
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<android.support.v4.widget.SwipeRefreshLayout
android:id="@+id/refreshlayout1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<WebView
android:id="@+id/webView"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</android.support.v4.widget.SwipeRefreshLayout>
</LinearLayout>
这是我的清单文件
<activity android:name="com.sherdle.universal.qrcodeactivity"
android:theme="@style/AppThemeBar"></activity>
风格
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">@color/myPrimaryColor</item>
<item name="colorPrimaryDark">@color/myPrimaryDarkColor</item>
<item name="colorAccent">@color/myAccentColor</item>
<item name="android:textColorPrimary">@color/myTextPrimaryColor</item>
<item name="drawerArrowStyle">@style/DrawerArrowStyle</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:textColor">@color/black</item>
<item name="android:windowBackground">@color/myWindowBackground</item>
</style>
<style name="AppThemeBar" parent="AppTheme">
</style>
<style name="DrawerArrowStyle" parent="Widget.AppCompat.DrawerArrowToggle">
<item name="spinBars">true</item>
<item name="color">@android:color/white</item>
</style>
<style name="ToolBarStyle" parent="">
<item name="android:theme">@style/Toolbar</item>
</style>
<style name="Toolbar" parent="Base.ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">#fff</item>
<item name="titleTextAppearance">@style/Toolbar_Title</item>
</style>
<style name="Toolbar_Popup" parent="Base.ThemeOverlay.AppCompat.ActionBar">
<item name="android:textColorPrimary">#fff</item>
</style>
<style name="Toolbar_Title" parent="@style/TextAppearance.Widget.AppCompat.Toolbar.Title">
<item name="android:textSize">20sp</item>
</style>
<style name="CardActionButton">
<item name="android:textSize">16dp</item>
<item name="android:textColor">@drawable/card_button</item>
<item name="android:ellipsize">end</item>
<item name="android:gravity">start|center</item>
<item name="android:paddingLeft">16.0dip</item>
<item name="android:paddingRight">4dp</item>
<item name="android:maxLines">2</item>
<item name="android:drawablePadding">4.0dip</item>
</style>
<style name="listTitle">
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:lineSpacingExtra">1dp</item>
<item name="android:paddingLeft">5dp</item>
<item name="android:paddingTop">2dp</item>
<item name="android:maxLines">2</item>
<item name="android:ellipsize">end</item>
<item name="android:textColor">@color/dark_gray</item>
<item name="android:fontFamily">sans-serif-light</item>
<item name="android:textAppearance">?android:attr/textAppearanceMedium</item>
</style>
<style name="listStyle">
<item name="android:clipToPadding">false</item>
<item name="android:listSelector">@android:color/transparent</item>
<item name="android:paddingTop">@dimen/activity_vertical_margin</item>
<item name="android:paddingBottom">@dimen/activity_vertical_margin</item>
<item name="android:paddingLeft">@dimen/activity_horizontal_margin</item>
<item name="android:paddingRight">@dimen/activity_horizontal_margin</item>
</style>
<style name="listStyleNoPadding">
<item name="android:clipToPadding">false</item>
<item name="android:listSelector">@android:color/transparent</item>
<item name="android:paddingBottom">@dimen/activity_vertical_margin</item>
</style>
</resources>