2017-04-14 42 views
0

我的問題是,動作條重疊的任何視圖內容喜歡這裏:應用程式內,瀏覽器:動作條重疊的WebView內容

enter image description here

比較,它看起來應該像這樣與Instagram的標誌:https://www.instagram.com/about/us/


這是我的我的InAppBrowser的activity_browser.xml打開外部視圖內容

<?xml version="1.0" encoding="utf-8"?> 
<android.support.design.widget.CoordinatorLayout 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/main_content" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="@android:color/white" 
    android:fitsSystemWindows="true" 
    tools:context=".InAppBrowser"> 

    <android.support.design.widget.AppBarLayout 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:theme="@style/AppTheme.AppBarOverlay"> 

     <android.support.v7.widget.Toolbar 
      android:id="@+id/toolbar" 
      android:layout_width="match_parent" 
      android:layout_height="?attr/actionBarSize" 
      android:background="?attr/colorPrimaryDark" 
      app:popupTheme="@style/AppTheme.PopupOverlay" /> 

    </android.support.design.widget.AppBarLayout> 

    <WebView 
     android:id="@+id/webView" 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" /> 

    <ProgressBar 
     android:id="@+id/progressBar" 
     style="@style/Widget.AppCompat.ProgressBar.Horizontal" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:layout_marginTop="-7dp" 
     android:indeterminate="true" 
     android:visibility="gone" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

</android.support.design.widget.CoordinatorLayout> 

Actionbar與webview重疊,所以webview內容似乎開始於Actionbar啓動的位置。

我試着換AppBarLayout,產生額外RelativeLayoutWebViewProgressBar但是這也不能工作。

我欣賞任何建議。

回答

0

我剛加入

android:layout_marginTop="?attr/actionBarSize" 

WebView,現在它視覺的作品,因爲我設置margin偏移量大小相同的動作條,但我認爲這更多的是一種哈克解決方案,所以我仍然欣賞其他解決方案/建議。