2016-06-01 18 views
0

Ich versuche transparente Werkzeugleiste, die andere Ansicht überlappen muss. Aber umgekehrt überlappen andere Ansichten die Symbolleiste.Ansicht Überlappung Werkzeugleiste

enter image description here

In xml ich speziell MarginTop für RelativeLayout verwendet, die überlappende zeigen. Eigentlich verwende ich marginTop nicht für RelativeLayout.

xml

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 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" 
    xmlns:tools="http://schemas.android.com/tools" 
    tools:context=".activity.activitys.ActivityImage"> 
    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     android:gravity="center"> 

     <android.support.v7.widget.AppCompatTextView 
      android:id="@+id/action_bar_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Фото"/> 
    </android.support.v7.widget.Toolbar> 

    <RelativeLayout 
     android:layout_marginTop="30dp" 
     android:id="@+id/img_slideshow_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/img_border" 
     > 
     <android.support.v4.view.ViewPager 
      android:id="@+id/viewpager" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      /> 
     <kz.dreamwings.zhaksyadam.activity.util.CircleIndicator 
      android:id="@+id/indicator" 
      android:layout_width="fill_parent" 
      android:layout_height="55dp" 
      android:padding="3dip" 
      android:background="#99000000" 
      android:layout_above="@+id/img_name" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentEnd="true" 
      android:layout_alignParentBottom="true"/> 
    </RelativeLayout> 

</FrameLayout> 
+1

try - android: layout_below = "@ + id/Symbolleiste" in der relativen Layout (das heißt img_slideshow_layout) und auch MarginTop Attribut aus dem gleichen –

+0

Verwendung Linearlayout statt FrameLayout und alles wird gut entfernen sein –

Antwort

0

Änderung dieser Code wie:

<FrameLayout 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" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:background="@drawable/img_border" 
    tools:context=".activity.activitys.ActivityImage"> 
    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="@android:color/transparent" 
     android:gravity="center"> 

     <android.support.v7.widget.AppCompatTextView 
      android:id="@+id/action_bar_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Фото"/> 
    </android.support.v7.widget.Toolbar> 

    <RelativeLayout 
     android:layout_marginTop="30dp" 
     android:id="@+id/img_slideshow_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     > 
     . 
     . 
     . 
0

Try this: add toolbar nach relativ Layout und oberen Rand entfernen.
.i.e:

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout 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" 
    xmlns:tools="http://schemas.android.com/tools" 
    tools:context=".activity.activitys.ActivityImage"> 


    <RelativeLayout 
     android:id="@+id/img_slideshow_layout" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@drawable/img_border" 
     > 
     <android.support.v4.view.ViewPager 
      android:id="@+id/viewpager" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      /> 
     <kz.dreamwings.zhaksyadam.activity.util.CircleIndicator 
      android:id="@+id/indicator" 
      android:layout_width="fill_parent" 
      android:layout_height="55dp" 
      android:padding="3dip" 
      android:background="#99000000" 
      android:layout_above="@+id/img_name" 
      android:layout_alignParentRight="true" 
      android:layout_alignParentEnd="true" 
      android:layout_alignParentBottom="true"/> 
    </RelativeLayout> 
    <android.support.v7.widget.Toolbar 
     android:id="@+id/toolbar" 
     android:layout_width="match_parent" 
     android:layout_height="?attr/actionBarSize" 
     android:background="?attr/colorPrimary" 
     android:gravity="center"> 

     <android.support.v7.widget.AppCompatTextView 
      android:id="@+id/action_bar_text" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Фото"/> 
    </android.support.v7.widget.Toolbar> 

</FrameLayout> 
1

Sie FrameLayout verwenden, die im Grunde ist ein einziges Kind zu halten. Sie können die Ausrichtung von Kindern in FrameLayout nicht verwalten. Ihr Layout sollte so sein.

<?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:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:fitsSystemWindows="true"> 

    <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/colorPrimary" 
      android:gravity="center"> 

      <android.support.v7.widget.AppCompatTextView 
       android:id="@+id/action_bar_text" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="Фото" /> 
     </android.support.v7.widget.Toolbar> 

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

    <android.support.v4.widget.NestedScrollView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:descendantFocusability="blocksDescendants" 
     android:scrollbars="none" 
     app:layout_behavior="@string/appbar_scrolling_view_behavior"> 

     <RelativeLayout 
      android:id="@+id/img_slideshow_layout" 
      android:layout_width="match_parent" 
      android:layout_height="wrap_content" 
      android:background="@drawable/img_border"> 

      <android.support.v4.view.ViewPager 
       android:id="@+id/viewpager" 
       android:layout_width="match_parent" 
       android:layout_height="match_parent" /> 

      <kz.dreamwings.zhaksyadam.activity.util.CircleIndicator 
       android:id="@+id/indicator" 
       android:layout_width="fill_parent" 
       android:layout_height="55dp" 
       android:layout_above="@+id/img_name" 
       android:layout_alignParentBottom="true" 
       android:layout_alignParentEnd="true" 
       android:layout_alignParentRight="true" 
       android:background="#99000000" 
       android:padding="3dip" /> 
     </RelativeLayout> 

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


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