The app works good, except for the fact that when I enter some notes, the first note disappears behind the app bar. How can I start that part from under the app bar?
xml:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.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"
tools:openDrawer="start">
<android.support.design.widget.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_main"
app:menu="@menu/activity_main_drawer" />
<ListView
android:id="@+id/android:list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context=".Notities">
<at.markushi.ui.CircleButton
android:layout_width="64dp"
android:layout_height="wrap_content"
app:cb_color="@color/primary"
app:cb_pressedRingWidth="8dp"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:src="@drawable/ic_action_add"
android:onClick="openEditorForNewNote"
android:minWidth="64dp"
android:minHeight="64dp" />
</RelativeLayout>
<include
layout="@layout/app_bar_notities"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!--<Button-->
<!--android:id="@+id/button"-->
<!--android:layout_width="wrap_content"-->
<!--android:layout_height="wrap_content"-->
<!--android:layout_alignParentBottom="true"-->
<!--android:layout_alignParentEnd="true"-->
<!--android:layout_alignParentRight="true"-->
<!--android:onClick="openEditorForNewNote"-->
<!--android:text="New note" />-->
</android.support.v4.widget.DrawerLayout>

The
DrawerLayoutandAppBarboth seem to be set up incorrectly. YourDrawerLayoutshould only contain two children, one for the main content and one for the drawer content. The drawer content should be below the main content in your XML, and thelayout_widthfor the drawer content should probably be a set dimension, usually240dp. Something like this:Then your
AppBarshould be placed in aCoordinatorLayoutin yourcontent_frame, with your main content (yourListView) placed below:And finally your
ListView(orRecyclerView) can be placed in any kind of layout you choose (I chose aFrameLayouthere):Also, if you noticed, I included the attribute
app:layout_behavior="@string/appbar_scrolling_view_behavior"in myFrameLayout. This is important as it sets the behavior of theAppBarLayoutand how it should react to yourFrameLayout. Basically, it makes it so the view is below theAppBar, and can scroll if necessary.Side Note:
I also noticed you are using the
at.markushi.ui.CircleButtonfrom an external library. This library was created before Google introduced the support library including the Floating Action Button, and is nowdeprecated. Since Google has introduced the newFloatingActionButton, you can use it in yourCoordinatorLayoutas the last element: