gpt4 book ai didi

android - BottomNavigationView 隐藏了我的 webview

转载 作者:搜寻专家 更新时间:2023-11-01 09:35:48 24 4
gpt4 key购买 nike

我有一个 BottomNavigationView Activity 。在那里,每当 WebView 加载网站时,我都有一个 WebView fragment 。 BottomNavigationView 隐藏了我的 WebView 的底部,有没有人可以帮助我解决这个问题?

这是我的 activity_main.xml,其中包含 BottomNavigationView

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:id="@+id/container"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.hackerinside.jaisonjoseph.polysocial.MainActivity">




<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:attr/windowBackground"
android:layout_alignParentBottom="true"
app:menu="@menu/navigation" />

</RelativeLayout>

这是我的第一个包含 webview 的 fragment 代码

<LinearLayout 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:orientation="vertical"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:context="com.hackerinside.jaisonjoseph.polysocial.tab2">


<FrameLayout
android:id="@+id/frame1"
android:layout_width="match_parent"
android:layout_height="3dp"
android:background="@android:color/transparent">


<ProgressBar
android:id="@+id/progressBar1"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="fill_parent"
android:layout_height="3dp"
android:background="@android:color/transparent"
android:foregroundGravity="top"
android:progressDrawable="@drawable/custom_progress"
android:progress="20"/>

</FrameLayout>


<android.support.v4.widget.SwipeRefreshLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/swiperefresh1"
android:layout_width="match_parent"
android:layout_height="match_parent">

<com.hackerinside.jaisonjoseph.polysocial.EulaWebView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/webview"
android:focusable="true"
android:focusableInTouchMode="true" />

</android.support.v4.widget.SwipeRefreshLayout>

</LinearLayout>

Refer the screenshot

最佳答案

你只需要添加一个 FrameLayout(它将是你的容器,所以保持它的 id 为 android:id="@+id/container")

and replace your code of activity_main.xml

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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"

>


<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/container"
android:layout_above="@+id/navigation"
>

</FrameLayout>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="?android:attr/windowBackground"
android:layout_alignParentBottom="true"
app:menu="@menu/navigation" />

</RelativeLayout>

关于android - BottomNavigationView 隐藏了我的 webview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43323055/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com