Android-DrawerLayout无法与其他工具配合使用

时间:2019-02-25 20:12:38

标签: android xml layout drawerlayout navigationview

我正在关注本教程:

https://www.youtube.com/watch?v=mN6kM_1M0cY

到目前为止,我在视频中间,那里还没有任何代码(java / kotlin),但是DrawerLayout已经可以工作了,但是对我来说不是。因此,我猜这是由于viewpager引起的,或者我不知道出了什么问题。

这是到目前为止的整个布局:

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:tools="http://schemas.android.com/tools"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@color/colorVeryLightGray"
        tools:context=".MainActivity">


    <android.support.design.widget.TabLayout
            android:id="@+id/tablayout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:background="@color/colorPrimary"
            app:tabSelectedTextColor="@android:color/white"
            app:tabTextColor="@color/colorHalfTransparent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent">


        <android.support.design.widget.TabItem
                android:id="@+id/tabRecent"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Recent Videos"
                app:tabIndicatorHeight="8dp"/>

        <android.support.design.widget.TabItem
                android:id="@+id/tabTrending"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="Trending Videos"
                app:tabIndicatorHeight="8dp"/>

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

    <android.support.v4.widget.DrawerLayout
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintTop_toBottomOf="@id/tablayout"
            app:layout_constraintBottom_toTopOf="@+id/IDadsMainBottom"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            tools:context="com.amoflirt.funnyvideosfeed.MainActivity">

        <android.support.design.widget.NavigationView
                android:id="@+id/naviView"
                android:layout_width="wrap_content"
                android:layout_height="match_parent"
                android:layout_gravity="start"
                app:menu="@menu/drawermenu">

            <View
                    android:id="@+id/toolbar_shadow"
                    android:layout_width="match_parent"
                    android:layout_height="6dp"
                    android:layout_alignParentStart="true"
                    android:background="@drawable/shape_shadow"/>

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

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



    <View
            android:id="@+id/toolbar_shadow2"
            android:layout_width="match_parent"
            android:layout_height="6dp"
            android:layout_alignParentStart="true"
            android:background="@drawable/shape_shadow"
            app:layout_constraintTop_toBottomOf="@+id/tablayout"/>

    <android.support.v4.view.ViewPager
            android:id="@+id/viewPager"
            android:layout_width="0dp"
            android:layout_height="0dp"
            app:layout_constraintTop_toBottomOf="@+id/tablayout"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintBottom_toTopOf="@+id/IDadsMainBottom">

    </android.support.v4.view.ViewPager>


    <android.support.constraint.ConstraintLayout
            android:layout_width="0dp"
            android:layout_height="50dp"
            android:background="@color/colorAccent"
            android:id="@+id/IDadsMainBottom"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent">

    </android.support.constraint.ConstraintLayout>

这可能是什么问题?预先感谢

0 个答案:

没有答案