java - ListView overlaps Application Bar - Android -


my listview go on application bar @ edge of page, have problem in layout file. (i've used default android studio activity contain navigation drawer, application bar,...) i've used framelayout use parent sub-activity , show navigation drawer in sub-activity.

nav_header_main.xml

<linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="@dimen/nav_header_height"     android:background="@drawable/side_nav_bar"     android:gravity="bottom"     android:orientation="vertical"     android:paddingbottom="@dimen/activity_vertical_margin"     android:paddingleft="@dimen/activity_horizontal_margin"     android:paddingright="@dimen/activity_horizontal_margin"     android:paddingtop="@dimen/activity_vertical_margin"     android:theme="@style/themeoverlay.appcompat.dark">      <imageview         android:id="@+id/imageview"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:paddingtop="@dimen/nav_header_vertical_spacing"         android:src="@android:drawable/sym_def_app_icon" />      <textview         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:paddingtop="@dimen/nav_header_vertical_spacing"         android:text="moviesinformer"         android:textappearance="@style/textappearance.appcompat.body1" />      <textview         android:id="@+id/textview"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="testing" /> 

content_main.xml

<relativelayout 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"     app:layout_behavior="@string/appbar_scrolling_view_behavior"     tools:context=".activity.mainactivity"     tools:showin="@layout/app_bar_main">      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:text="movieys informer" /> </relativelayout> 

app_bar_main.xml

<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"     android:fitssystemwindows="true"     tools:context=".activity.mainactivity">      <android.support.design.widget.appbarlayout         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:theme="@style/apptheme.appbaroverlay">          <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/apptheme.popupoverlay" />      </android.support.design.widget.appbarlayout>      <framelayout         android:id="@+id/content_frame"         android:layout_width="match_parent"         android:layout_height="match_parent" />      <!--<include layout="@layout/content_main" />-->  </android.support.design.widget.coordinatorlayout> 

activity_main.xml

<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">      <include         layout="@layout/app_bar_main"         android:layout_width="match_parent"         android:layout_height="match_parent" />      <!--<framelayout-->         <!--android:id="@+id/content_frame"-->         <!--android:layout_width="match_parent"-->         <!--android:layout_height="match_parent" />-->      <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" />   </android.support.v4.widget.drawerlayout> 

cinema_activity.xml (which used in sub-activity)

 <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"     android:orientation="vertical" android:layout_width="match_parent"     android:layout_height="wrap_content">      <listview         android:layout_width="fill_parent"         android:layout_height="fill_parent"         android:textalignment="center"         android:clickable="true"         android:id="@+id/lwcinema"         />   </linearlayout> 

can please me?

repeat:

the listview in sub-activity go on top of application bar (i think it's called) it's still clickable. need put below app bar.

instead of using margintop="?android:attr/actionbarsize", right way add app:layout_behavior attribute framelayout. attribute make frame layout positioned below toolbar.

<framelayout     android:id="@+id/content_frame"     android:layout_width="match_parent"     android:layout_height="match_parent"     app:layout_behavior="@string/appbar_scrolling_view_behavior" /> 

and don't forget add xmlns:app="http://schemas.android.com/apk/res-auto" tag root of layout.


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -