0

플로팅 작업 버튼과 같은 위치에있는 내 MainActivity에 ImageView가 있습니다. ImageView가 플로팅 동작 버튼과 같은 모든 것 위에 있기를 원합니다. 현재 모양은 다음과 같습니다. https://gyazo.com/ee0aca8d5bc5061d3e437e6d71575ee8ImageView는 플로팅 작업 버튼과 같은 모든 것 위에 있어야합니다.

ImageView가 버튼 뒤에 있습니다. 하지만 항상 포 그라운드에서 앱의 각 사이트에 있기를 원합니다.

내 activity_main.XML :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:ads="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:orientation="vertical"> 


    <android.support.v7.widget.Toolbar 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/orange" 
     android:id="@+id/toolbar" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     app:title="Tanzverbot Soundboard" /> 

    <android.support.v4.widget.DrawerLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:id="@+id/drawerLayout"> 

     <RelativeLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/containerView"> 

      <ImageView 
       android:id="@+id/fab" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom|end" 
       android:src="@drawable/tanzit" 
       android:adjustViewBounds="true" 
       android:maxWidth="50dp" 
       android:maxHeight="50dp" 
       android:layout_above="@+id/adView" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentEnd="true" 
       android:layout_marginRight="32dp" 
       android:layout_marginEnd="32dp" 
       android:layout_marginBottom="38dp" /> 

      <com.google.android.gms.ads.AdView 
       android:id="@+id/adView" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_alignParentBottom="true" 
       ads:adSize="SMART_BANNER" 
       android:layout_gravity="bottom|end" 
       ads:adUnitId="@string/banner_ad_unit_id"> 
      </com.google.android.gms.ads.AdView> 

     </RelativeLayout> 



     <android.support.design.widget.NavigationView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="start" 
      android:id="@+id/shitstuff" 
      app:itemTextColor="@color/black" 
      app:menu="@menu/drawermenu" 
      /> 


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


</LinearLayout> 

답변

0

봅니다 ImageViewcom.google.android.gms.ads.AdView 교환합니다. 또한,이 시도하여 ImageView

android:elevation="10dp" 
0

당신은 대신 FrameLayout를 사용해야합니다 그것으로, 레이아웃의 마지막보기는 전경에 항상있을 것이다.

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:ads="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:orientation="vertical"> 


    <android.support.v7.widget.Toolbar 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@color/orange" 
     android:id="@+id/toolbar" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     app:title="Tanzverbot Soundboard" /> 

    <android.support.v4.widget.DrawerLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:id="@+id/drawerLayout"> 

     <FrameLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/containerView"> 

      <ImageView 
       android:id="@+id/fab" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom|end" 
       android:src="@drawable/tanzit" 
       android:adjustViewBounds="true" 
       android:maxWidth="50dp" 
       android:maxHeight="50dp" 
       android:layout_above="@+id/adView" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentEnd="true" 
       android:layout_marginRight="32dp" 
       android:layout_marginEnd="32dp" 
       android:layout_marginBottom="38dp" /> 

      <com.google.android.gms.ads.AdView 
       android:id="@+id/adView" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_alignParentBottom="true" 
       ads:adSize="SMART_BANNER" 
       android:layout_gravity="bottom|end" 
       ads:adUnitId="@string/banner_ad_unit_id"> 
      </com.google.android.gms.ads.AdView> 

     </FrameLayout> 



     <android.support.design.widget.NavigationView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="start" 
      android:id="@+id/shitstuff" 
      app:itemTextColor="@color/black" 
      app:menu="@menu/drawermenu" 
      /> 


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


</LinearLayout> 
+0

. 그리고 실제로'DrawerLayout' 자체가 틀리면'FrameLayout'을 확장합니다. – Ivan

+0

컨테이너에 대해 얘기하고 있습니다. –

+0

@LuizFernandoSalvaterra https://gyazo.com/9275e291f215d92d5e7f2b8740a3d749 –

0

을 위해 고도를 설정하려고 할 수 있습니다 : 그는 그 아래 상단과 내용에`Toolbar`을 가지고`LinearLayout`을 필요로

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:ads="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:orientation="vertical"> 

    <android.support.v7.widget.Toolbar 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:background="@android:color/holo_orange_light" 
     android:id="@+id/toolbar" 
     android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" 
     app:title="Tanzverbot Soundboard" /> 

    <android.support.v4.widget.DrawerLayout 
     xmlns:android="http://schemas.android.com/apk/res/android" 
     xmlns:app="http://schemas.android.com/apk/res-auto" 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:id="@+id/drawerLayout"> 

     <RelativeLayout 
      android:orientation="vertical" 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/containerView"> 

      <com.google.android.gms.ads.AdView 
       android:id="@+id/adView" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_centerHorizontal="true" 
       android:layout_alignParentBottom="true" 
       ads:adSize="SMART_BANNER" 
       android:layout_gravity="bottom|end" 
       ads:adUnitId="@string/banner_ad_unit_id"> 
      </com.google.android.gms.ads.AdView> 

      <ImageView 
       android:id="@+id/fab" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_gravity="bottom|end" 
       android:src="@mipmap/ic_launcher" 
       android:adjustViewBounds="true" 
       android:maxWidth="50dp" 
       android:maxHeight="50dp" 
       android:layout_above="@+id/adView" 
       android:layout_alignParentRight="true" 
       android:layout_alignParentEnd="true" 
       android:layout_marginRight="32dp" 
       android:layout_marginEnd="32dp" 
       android:layout_marginBottom="38dp" /> 

     </RelativeLayout> 

     <android.support.design.widget.NavigationView 
      xmlns:android="http://schemas.android.com/apk/res/android" 
      xmlns:app="http://schemas.android.com/apk/res-auto" 
      android:layout_width="wrap_content" 
      android:layout_height="match_parent" 
      android:layout_gravity="start" 
      android:id="@+id/shitstuff" 
      app:itemTextColor="@color/black" 
      app:menu="@menu/drawermenu" /> 

    </android.support.v4.widget.DrawerLayout> 
</LinearLayout> 
+0

여전히 다음과 같이 보입니다. https://gyazo.com/9275e291f215d92d5e7f2b8740a3d749 –