0

I am using Navigation Drawer Pager Sliding Tab Strip. It is showing menus in Slider. Now, I want to add Profile Photo and User Name in Slider. I have tried adding LinearLayout but It is giving ClassCastException.

Source : https://github.com/Balaji-K13/Navigation-drawer-page-sliding-tab-strip

activity.xml :

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawer_layout"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <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:id="@+id/content"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >
    </RelativeLayout>

    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:background="@color/lightish"
        android:choiceMode="singleChoice"
        android:divider="@color/blue"
        android:dividerHeight="1dp" />

</android.support.v4.widget.DrawerLayout>
Jeeten Parmar
  • 4,762
  • 12
  • 51
  • 101
  • I suppose you need to implement your own custom adapter to get what you need. Take an example here http://www.tutecentral.com/android-custom-navigation-drawer/ – Ye Lin Aung Apr 20 '14 at 12:41
  • Check the link below, helped me a lot about this: http://ux.stackexchange.com/questions/44776/navigation-drawer-with-my-account-entry – Rafael Jul 11 '14 at 05:10

1 Answers1

0

Use this layout and you'll get what you need.

<android.support.v4.widget.DrawerLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/drawerlayout"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <!-- Framelayout to display Fragments -->
    <FrameLayout
        android:id="@+id/frameContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

    </FrameLayout>

    <!-- Left drawer -->
    <LinearLayout
        android:id="@+id/leftDrawer"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:orientation="vertical"
        android:gravity="center" >

        <ImageView
            android:id="@+id/imgProfilePic"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:background="@drawable/user_placeholder_88"
            android:contentDescription="@string/profile_pic" />

        <TextView
            android:id="@+id/lblUsername"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="20dip"
            android:textStyle="bold"
            android:textAppearance="@android:style/TextAppearance.Medium" />

        <ListView
            android:id="@+id/drawerList"
            android:layout_width="fill_parent"
            android:layout_height="match_parent"
            android:choiceMode="singleChoice"
            android:divider="@color/drawerListDivider"
            android:dividerHeight="0dp"        
            android:listSelector="@drawable/drawer_list_selector"
            android:background="@color/drawerListBackground"/>

    </LinearLayout>

</android.support.v4.widget.DrawerLayout>
vino
  • 13
  • 4