android - React Native Navigation Drawer overlap status bar -


enter image description here

the react navigation drawer overlaps android status bar. there way prevent that? source here

contentoptions: {   style: {     margintop: 24,   }, }, 

this gives margin content, not whole drawer.

try hope helpful you

1.make "header layout" in which, want image , text. enter image description here(prepare custom menu-drawer)

<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  android:id="@+id/ll_parenthide"  android:layout_width="match_parent"  android:layout_height="wrap_content"  android:background="@color/coloraccent"  android:orientation="vertical"  android:theme="@style/themeoverlay.appcompat.dark"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_gravity="center" android:gravity="center" android:layout_margintop="@dimen/_10dp" android:layout_marginbottom="@dimen/_10dp"> <imageview     android:id="@+id/ivprofile"     android:layout_width="@dimen/_80dp"     android:background="@drawable/no_image"     android:layout_height="@dimen/_80dp"     android:layout_gravity="center" /> <textview     android:id="@+id/tv_uname"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:textsize="@dimen/titlesize"     android:layout_margintop="@dimen/_10dp"     android:textcolor="@color/colorwhite"     android:text=""     android:gravity="center"     android:layout_gravity="center"     android:textalignment="center" /> <textview     android:id="@+id/tv_user_id"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     android:textsize="@dimen/textsize"     android:layout_gravity="center"     android:gravity="center"     android:textcolor="@color/colorwhite"     android:layout_margintop="@dimen/_5dp"     android:text=""     android:textalignment="center" /> </linearlayout> 

  1. then make layout drawer-menu. parent_main

 <?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="end">  <linearlayout  xmlns:android="http://schemas.android.com/apk/res/android"  xmlns:app="http://schemas.android.com/apk/res-auto"  android:layout_width="match_parent"  android:layout_height="match_parent"  android:id="@+id/ll_layout_parent"  android:orientation="vertical"> <include android:id="@+id/include" layout="@layout/tool_bar"></include> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent"> <linearlayout     android:id="@+id/ll_layout"     android:layout_width="match_parent"     android:layout_height="@dimen/_55dp"     android:background="@drawable/white_background"     android:orientation="horizontal"     android:layout_alignparentbottom="true">     <imageview         android:layout_width="wrap_content"         android:layout_height="wrap_content" />     </relativelayout>     </linearlayout>     <linearlayout android:layout_width="wrap_content" android:layout_height="match_parent" android:orientation="horizontal" android:layout_gravity="end"> <linearlayout     android:layout_width="@dimen/_1dp"     android:layout_height="match_parent"     android:background="@color/coloraccent"/> <android.support.design.widget.navigationview     android:id="@+id/nav_view"     android:layout_width="@dimen/_200dp"     android:layout_height="match_parent"     android:background="@color/colorprimary"     android:fitssystemwindows="true"     app:headerlayout="@layout/nav_header_home"     app:itemtextcolor="@color/colortext">     <android.support.v7.widget.recyclerview         android:id="@+id/rv_navigation"         android:layout_width="match_parent"         android:layout_height="match_parent"         android:layout_margintop="@dimen/_160dp"         android:listselector="@color/colorwhite"         android:divider="@null">     </android.support.v7.widget.recyclerview> </android.support.design.widget.navigationview> </linearlayout> </android.support.v4.widget.drawerlayout> 

  1. make class navigation adapter

public class navigationdraweradapter extends  recyclerview.adapter<navigationdraweradapter.myviewholder> { private layoutinflater inflater; private list<hashmap<string,string>> focusheader; private context context; public static boolean  snackbar snackbar; string[] name={ "about focus", "faq", "help"};  integer[] image_id={  r.drawable.logo,  r.drawable.faq,  r.drawable.help,};  intent intent;  public navigationdraweradapter(list<hashmap<string,string>>   focusheader,context context) {  this.focusheader=focusheader;  this.context = context;  inflater = layoutinflater.from(context);}  @override  public myviewholder oncreateviewholder(viewgroup parent, int viewtype) {  view view = inflater.inflate(r.layout.nav_drawer_row, parent, false);  myviewholder holder = new myviewholder(view);  return holder;  }  @override  public void onbindviewholder(myviewholder holder, final int position) {  holder.tv_subtitle.settext(name[position]);  holder.iv_drawericon.setimageresource(image_id[position]);  holder.itemview.setonclicklistener(new view.onclicklistener() {  @override public void onclick(view view) {      else if (name[position].equals("about focus")){          }     else if (name[position].equals("faq")){      }     else if (name[position].equals("help")){      }      });     }      @override     public int getitemcount() {     return name.length;     }     class myviewholder extends recyclerview.viewholder {    textview tv_title,tv_subtitle;    imageview iv_drawericon;     public myviewholder(view itemview) {    super(itemview);    iv_drawericon=itemview.findviewbyid(r.id.iv_drawericon);    tv_subtitle=itemview.findviewbyid(r.id.tv_subtitle);    }    } 

  1. make layout nav_drawer_row

<linearlayout android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="horizontal" android:gravity="center" android:weightsum="1" android:layout_margin="@dimen/_15dp"> <imageview     android:id="@+id/iv_drawericon"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_weight="0.8"/> <textview     android:id="@+id/tv_subtitle"     android:layout_width="match_parent"     android:layout_height="wrap_content"     android:layout_gravity="center"     android:textsize="@dimen/textsize"     android:layout_weight="0.2"     android:textstyle="bold"     android:layout_marginleft="@dimen/_10dp"     android:textcolor="@color/colorwhite" /> </linearlayout> 

  1. use class parent_main

public class tabactivityclass extends appcompatactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.parent_main); recyclerview.layoutmanager mlayoutmanager = new  linearlayoutmanager(getapplicationcontext()); rv_navigation.setlayoutmanager(mlayoutmanager); rv_navigation.setitemanimator(new defaultitemanimator()); rv_navigation.setadapter(new navigationdraweradapter(new  arraylist<hashmap<string, string>>(),parent_main.this)); drawer = (drawerlayout) findviewbyid(r.id.drawer_layout); actionbardrawertoggle toggle = new actionbardrawertoggle(         this, drawer, toolbar, r.string.navigation_drawer_open,         r.string.navigation_drawer_close); drawer.adddrawerlistener(toggle); toggle.setdrawerindicatorenabled(false); toggle.syncstate(); } } 

Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -