android - Adding a fragment with custom view to sliding navigation -


i want have navigation drawer arbitrary views inside of it. not list items. possible? library should use implement this?

"is possible?"
ans: yes

"what library should use implement this?"

ans: navigation drawer in android sdk work perfectly.

official doc: http://developer.android.com/training/implementing-navigation/nav-drawer.html

drawerlayoutclass child class of viewgroup, means has features of view group. not restricted listview can add type of view inside drawerlayout.

example:

<?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout     android:id="@+id/drawer_layout"     xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="match_parent"     android:layout_height="match_parent"> <!-- main content view --> <framelayout     android:id="@+id/content_frame"     android:layout_width="match_parent"     android:layout_height="match_parent"     android:background="@android:color/holo_green_dark">      <textview         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_gravity="center"         android:text="content of drawer"         android:textcolor="@android:color/holo_red_dark"         android:textsize="24sp"         />  </framelayout> <!-- navigation drawer --> <relativelayout     android:id="@+id/left_drawer"     android:layout_width="240dp"     android:layout_height="match_parent"     android:layout_gravity="start"     android:background="#12d"     >      <textview         android:id="@+id/drawer_view"         android:layout_width="wrap_content"         android:layout_height="wrap_content"         android:layout_centerinparent="true"         android:text="custom view"         android:textcolor="@android:color/secondary_text_light"         android:textsize="24sp"         android:textstyle="bold"         />  </relativelayout> 

output:

enter image description here


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -