2017-04-10 110 views
0

我有一个BottomNavigationView活动。在那里,我有一个webview片段,每当网络视图加载一个网站。 BottomNavigationView隐藏了我的网络视图的底部,有没有人可以帮我解决这个问题?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> 

这是一个包含web视图

<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

回答

1

你只是NEET添加的FrameLayout(这将是你容器,以便保持其ID为机器人:ID =“@ + id/container“)

并更换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> 
+0

当用户向下滚动webview时,我的应用程序隐藏了操作栏,但是当隐藏时,它会刺激底部导航,为什么? –

0

Actully要添加您的片段我的第一个片段码在您下面的导航下的所有布局。你应该使用下面的布局,并把你的片段放在内部布局中。

<?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" 
 
    > 
 
    <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" 
 
     /> 
 
<RelativeLayout 
 
    android:layout_width="match_parent" 
 
    android:layout_above="@id/navigation" 
 
    android:layout_height="match_parent"> 
 
    <!--Your code for the fragment here.--> 
 
</RelativeLayout> 
 

 
</RelativeLayout>

+0

I HV更换机智你的代码activity_main.xml中的代码,但导航视图消失 –

+0

它的作品添加应用后:菜单=“@菜单/导航“,但同样的问题发生 –

+0

简单地将android:id =”@ + id/container“行转移到内部相对布局。 –