1

NavigationDrawer imageI am new to android programming. i am really stucking in the place where i have to apply style like FlowingDrawer to DrawerLayout which already present. i have already created my navigationdrawer layout. in that i want to add FlowingDrawer. in my navigation drawer layout i have recycler view. please someone guide me to acheive this.

i want my layout look like this

FlowingDrawer Layout Picture

activity_home.xml

<androidx.drawerlayout.widget.DrawerLayout 
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/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:background="@android:color/white"
tools:openDrawer="start">

<include
    layout="@layout/app_bar_home"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

<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"
    android:fitsSystemWindows="true"
    app:headerLayout="@layout/nav_header_home"
    app:menu="@menu/activity_home_drawer" />

app_home_xml

   <androidx.coordinatorlayout.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"
tools:context=".Home">

<com.google.android.material.appbar.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/AppTheme.AppBarOverlay">

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

</com.google.android.material.appbar.AppBarLayout>

<include layout="@layout/content_home" />



 </androidx.coordinatorlayout.widget.CoordinatorLayout>

content_home.xml

   <androidx.constraintlayout.widget.ConstraintLayout 
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:background="@android:color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:showIn="@layout/app_bar_home">

<fragment
    android:id="@+id/nav_host_fragment"
    android:name="androidx.navigation.fragment.NavHostFragment"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    app:defaultNavHost="true"
    app:layout_constraintLeft_toLeftOf="parent"
    app:layout_constraintRight_toRightOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:navGraph="@navigation/mobile_navigation" />

<androidx.coordinatorlayout.widget.CoordinatorLayout


    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@android:color/white"
    android:orientation="vertical"
    tools:ignore="MissingConstraints">

    <com.google.android.material.appbar.AppBarLayout
        android:id="@+id/rl_main_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:elevation="0sp"

        android:background="@android:color/white">



        <LinearLayout
            android:layout_marginLeft="20dp"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/rent_motor_cycle_margin_top"
            android:orientation="horizontal"
            app:layout_scrollFlags="enterAlways|scroll">




            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="center"
                android:fontFamily="@font/inter_medium"
                android:gravity="center"

                android:text="Rent a Motorcycle"
                android:textColor="@android:color/black"
                android:textSize="@dimen/rent_motor_cycle_text" />

            <LinearLayout
                android:layout_width="fill_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="end|center"

                android:gravity="end|center"
                android:orientation="horizontal">

                <ImageView
                    android:layout_width="@dimen/motor_cycle_search_width"
                    android:textColor="@android:color/black"
                    android:layout_height="@dimen/motor_cycle_search_height"
                    android:layout_gravity="end|center"
                    android:gravity="end|center"
                    android:src="@drawable/ic_search_new"
                    android:visibility="gone" />
            </LinearLayout>
        </LinearLayout>

        <TextView
            android:layout_marginLeft="20dp"
            android:layout_width="wrap_content"
            android:textColor="@android:color/black"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/select_date_and_time_margin_top"
            android:fontFamily="@font/inter_regular"
            android:gravity="center"
            android:text="Select Date &amp; Time"
            android:textSize="@dimen/select_date_and_time_text"
            app:layout_scrollFlags="enterAlways|scroll" />

        <RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/startdate_enddate_text_margin_top"
            android:orientation="horizontal">

            <RelativeLayout
                android:id="@+id/relative_start_date"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignParentStart="true"
                android:layout_gravity="start|center"
                android:gravity="start|center"
                android:orientation="vertical"
                android:layout_alignParentLeft="true">

                <TextView
                    android:layout_marginLeft="20dp"
                    android:id="@+id/txt_start_date"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginBottom="@dimen/startdate_enddate_text_margin_bottom"
                    android:fontFamily="@font/inter_regular"
                    android:gravity="center"
                    android:text="START TIME"

                    android:textColor="@color/text_grey"
                    android:textSize="@dimen/startdate_enddate_text"
                    android:textStyle="bold" />

                <LinearLayout
                    android:layout_marginLeft="20dp"
                    android:id="@+id/linear_start_date"
                    android:clickable="true"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/txt_start_date"
                    android:background="@drawable/btn_grey_background_no_stroke"
                    android:orientation="horizontal"
                    android:paddingTop="@dimen/motorcycle_date_text_top"
                    android:paddingBottom="@dimen/motorcycle_date_text_bottom">

                    <ImageView
                        android:layout_width="@dimen/motorcycle_date_icon_width"
                        android:layout_height="@dimen/motorcycle_date_icon_height"
                        android:layout_gravity="center"
                        android:layout_marginStart="@dimen/motorcycle_date_icon_start"
                        android:src="@drawable/ic_calendar_white"
                        android:layout_marginLeft="@dimen/motorcycle_date_icon_start" />

                    <TextView

                        android:id="@+id/txt_from_date"
                        android:layout_width="90dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginStart="@dimen/motorcycle_date_text_start"
                        android:layout_marginEnd="@dimen/motorcycle_date_text_end"
                        android:fontFamily="@font/inter_regular"
                        android:gravity="center"
                        android:lineSpacingExtra="14.0sp"
                        android:text="03 Sep - 9.00 AM"
                        android:textColor="#ffffffff"
                        android:textSize="@dimen/motorcycle_date_text"
                        android:layout_marginRight="@dimen/motorcycle_date_text_end"
                        android:layout_marginLeft="@dimen/motorcycle_date_text_start" />
                </LinearLayout>
            </RelativeLayout>

            <RelativeLayout
                android:id="@+id/relative_end_date"
                android:layout_width="wrap_content"
                android:clickable="true"
                android:layout_height="wrap_content"
                android:layout_marginRight="20dp"
                android:layout_alignParentRight="true"
                android:layout_gravity="end|center"
                android:gravity="end|center"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/txt_end_date"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_gravity="center"
                    android:layout_marginBottom="@dimen/startdate_enddate_text_margin_bottom"
                    android:fontFamily="@font/inter_regular"
                    android:gravity="center"
                    android:text="END TIME"
                    android:textColor="@color/text_grey"
                    android:textSize="@dimen/startdate_enddate_text"
                    android:textStyle="bold" />

                <LinearLayout
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:layout_below="@+id/txt_end_date"
                    android:background="@drawable/btn_grey_background_no_stroke"
                    android:orientation="horizontal"
                    android:paddingTop="@dimen/motorcycle_date_text_top"
                    android:paddingBottom="@dimen/motorcycle_date_text_bottom">

                    <ImageView
                        android:layout_width="@dimen/motorcycle_date_icon_width"
                        android:layout_height="@dimen/motorcycle_date_icon_height"
                        android:layout_gravity="center"
                        android:layout_marginStart="@dimen/motorcycle_date_icon_start"
                        android:src="@drawable/ic_calendar_white"
                        android:layout_marginLeft="@dimen/motorcycle_date_icon_start" />

                    <TextView
                        android:id="@+id/txt_to_date"
                        android:layout_width="90dp"
                        android:layout_height="wrap_content"
                        android:layout_gravity="center"
                        android:layout_marginStart="@dimen/motorcycle_date_text_start"
                        android:layout_marginEnd="@dimen/motorcycle_date_text_end"
                        android:fontFamily="@font/inter_regular"
                        android:gravity="center"
                        android:lineSpacingExtra="14.0sp"
                        android:text="03 Sep - 9.00 AM"
                        android:textColor="#ffffffff"
                        android:textSize="@dimen/motorcycle_date_text"
                        android:layout_marginLeft="@dimen/motorcycle_date_text_start"
                        android:layout_marginRight="@dimen/motorcycle_date_text_end" />
                </LinearLayout>
            </RelativeLayout>

        </RelativeLayout>


    </com.google.android.material.appbar.AppBarLayout>

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginStart="@dimen/margin_xlarge"
        android:layout_marginTop="@dimen/margin_xlarge"
        android:layout_marginEnd="@dimen/margin_xlarge"
        android:visibility="visible"
        app:layout_behavior="@string/appbar_scrolling_view_behavior">



        <com.facebook.shimmer.ShimmerFrameLayout
            android:id="@+id/shimmer_view_container"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:layout_marginTop="15dp"
            android:orientation="vertical"
            >

            <!-- Adding 7 rows of placeholders -->
            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:orientation="vertical">
                <include layout="@layout/bike_placeholder_bg" />
                <include layout="@layout/bike_placeholder_bg" />
                <include layout="@layout/bike_placeholder_bg" />
                <include layout="@layout/bike_placeholder_bg" />
                <include layout="@layout/bike_placeholder_bg" />

            </LinearLayout>


        </com.facebook.shimmer.ShimmerFrameLayout>


        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/bikeslist"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:clipToPadding="false"
            android:paddingBottom="@dimen/margin_small"
            android:visibility="visible" />

        <LinearLayout
            android:id="@+id/linear_shimmer_view"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:orientation="vertical"
            android:visibility="gone">










            <include layout="@layout/bike_placeholder_bg" />




        </LinearLayout>
    </RelativeLayout>


</androidx.coordinatorlayout.widget.CoordinatorLayout>

4

0 回答 0