[英]WebView overlaps toolbar
I'm creating an application and I encountered some problem with my toolbar and webview. 我正在创建一个应用程序,但我的工具栏和Webview遇到了一些问题。 My webview overlaps my toolbar on top.
我的Web视图在顶部重叠了我的工具栏。 How can I fix this?
我怎样才能解决这个问题?
Here is my sample screenshot: 这是我的示例屏幕截图:
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ececec"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<include
android:id="@+id/toolbar"
layout="@layout/toolbar_top" />
<include
android:id="@+id/toolbar2"
layout="@layout/toolbar_bot" />
</android.support.design.widget.AppBarLayout>
</LinearLayout>
<android.support.v4.widget.NestedScrollView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="fill_vertical"
app:layout_behaviour="@string/appbar_scrolling_view_behaviour">
<!--STARTWEBVIEW -->
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="visible"/>
<!--ENDWEBVIEW-->
</android.support.v4.widget.NestedScrollView>
</android.support.constraint.ConstraintLayout>
can you paste the code of toolbar_top and toolbar_bot 您可以粘贴toolbar_top和toolbar_bot的代码吗
Try like this: 尝试这样:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#ececec"
tools:context=".MainActivity">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="#663300"
android:minHeight="?attr/actionBarSize"
/>
<!--STARTWEBVIEW -->
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_above="@id/toolbar1"
android:layout_below="@id/appBarLayout"
android:visibility="visible" />
<!--ENDWEBVIEW-->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:background="#663300"
android:minHeight="?attr/actionBarSize" />
</RelativeLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.