Action bar eat part from list view android

224 Views Asked by At

When use built in Navigation Drawer activity in android studio that includes action bar and my list view when run the app a part from the list view comes under action bar please help to solve the issue

File name app_bar_dept which include the action bar and include layout="@layout/content_dept" that refer to another file named content_dept

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.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=".dept">

<android.support.design.widget.AppBarLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/CustomActionBarTheme">



 <android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/CustomActionBarTheme"/>

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

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

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

File name content_dept

 <?xml version="1.0" encoding="utf-8"?>
    <android.support.constraint.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="wrap_content"
    app:layout_behavior="@string/appbar_scrolling_view_behavior"
    tools:context=".dept"
    tools:showIn="@layout/app_bar_dept">


        <ListView
        android:id="@+id/listview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:paddingTop="30dp"
        android:clipToPadding="false"
        android:scrollbarStyle="outsideOverlay"/>

    </android.support.constraint.ConstraintLayout>

Here the styles file

<resources>


<style name="AppTheme.NoActionBar">
    <item name="windowActionBar">false</item>
    <item name="windowNoTitle">true</item>
</style>

<style name="CustomActionBarTheme" parent="@style/Theme.AppCompat">
    <item name="android:windowActionBarOverlay">true</item>

    <!-- Support library compatibility -->
    <item name="windowActionBarOverlay">true</item>
</style>

<style name="AppTheme.AppBarOverlay" 
parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

<style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" 
/>

</resources>

actionbar2

Actionbar

1

There are 1 best solutions below

1
MrFisherman On

Try to change from this android:paddingTop="30dp" to this android:marginTop="30dp" in ListView.