Пустое пространство во фрагменте с Adview + ToolBar и AppBarLayout - PullRequest
0 голосов
/ 10 июля 2019

У меня есть recycleView и выше AdView, как XML ниже я использую AppBarLayout + Панель инструментов + TabLayout + FrameLayout

ниже отпечатка, как при открытии занятия below a print scrren of how it is when opening the activity

При прокрутке вверх это выглядит так: When scrolling up it looks like this:

Пожалуйста, кто-нибудь может мне помочь, указав, где в XML я пропускаю? Я уже провел 2 дня, и я не нашел решение

active_main.xml

<?xml version="1.0" encoding="utf-8"?>
<androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:ads="http://schemas.android.com/tools"
    android:id="@+id/drawer_layout"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:fitsSystemWindows="true"
    android:animateLayoutChanges="true"
    >
<!-- android:layout_above="@+id/linear"-->
    <androidx.coordinatorlayout.widget.CoordinatorLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:id="@+id/coordinator"
        >
        <com.google.android.material.appbar.AppBarLayout
            android:id="@+id/appbar"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppTheme.AppBarOverlay"

            android:fitsSystemWindows="false"
            >

            <androidx.appcompat.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_scrollFlags="scroll|enterAlways" />

            <com.google.android.material.tabs.TabLayout
                android:id="@+id/tab_layout"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                app:layout_scrollFlags="scroll|enterAlways"
                app:tabMode="fixed"
                />
        </com.google.android.material.appbar.AppBarLayout>
        <!--<include layout="@layout/sample" />
        <include layout="@layout/content_main" />
        -->
        <FrameLayout
            android:id="@+id/container"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            app:layout_behavior="@string/appbar_scrolling_view_behavior"
            android:layout_above="@+id/adViewMob"
            android:animateLayoutChanges="true"
            android:fitsSystemWindows="false"
            />
    </androidx.coordinatorlayout.widget.CoordinatorLayout>
    <com.google.android.material.navigation.NavigationView
        android:id="@+id/nav_view"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        app:menu="@menu/activity_main_drawer"
        app:headerLayout="@layout/nav_header_main"

        android:theme="@style/NavigationView"
        app:itemTextColor="#ffffff"
        android:background="#1a1b1d"
        />
    <!--app:itemBackground="@drawable/good" -->

<!--    <android.support.design.widget.FloatingActionButton
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        android:layout_margin="@dimen/fab_margin"
        app:srcCompat="@android:drawable/ic_dialog_email" />-->

</androidx.drawerlayout.widget.DrawerLayout>

fragment_container.xml

<FrameLayout
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    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:layout_above="@id/adViewMob"
    tools:context=".ContainerFragment"

    >

    <androidx.viewpager.widget.ViewPager
        android:id="@+id/viewPager"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@id/adViewMob"

        android:layout_marginBottom="0dp" />

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="?actionBarSize"
        android:id="@+id/rltLayout"
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        xmlns:android="http://schemas.android.com/apk/res/android">


        <com.google.android.gms.ads.AdView
            android:id="@+id/adViewMob"
            android:background="@color/white"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            ads:adSize="SMART_BANNER"
            ads:adUnitId="@string/ad_unit_id"/>


    </RelativeLayout>

</FrameLayout>

fragment_recycle.xml

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="match_parent"

    android:paddingTop="5dp"
    android:layout_height="match_parent">


    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="?actionBarSize"
        android:id="@+id/rltLayout"
        xmlns:ads="http://schemas.android.com/apk/res-auto"
        xmlns:android="http://schemas.android.com/apk/res/android">


        <com.google.android.gms.ads.AdView
            android:id="@+id/adViewMob"
            android:background="@color/transparent"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            ads:adSize="SMART_BANNER"
            ads:adUnitId="@string/ad_unit_id"/>


    </LinearLayout>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1"
        android:orientation="vertical">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/recyclerView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"

            android:paddingTop="5dp" />

    </LinearLayout>

</LinearLayout>
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...