Search code examples
androidyoutubeslidingmenuslidingdrawer

Make Custom Navigation drawer like You-Tube in android


Hello friends i wnat to make custom slidng drawer like you-tube in my application

enter image description here

When user click on any item it should be show me like above image which i highlight so any idea how can i achieve this ?


Solution

  • Yesterday I faced same problem

    but this examples highlight selector in whole listbackground but i also want red color indicator at starting which is mention

    You need to create two selector. 1. For whole item 2. for that red part

    For that Place a view in listitem on left side and create a selector for it.

    then use following code. Here android:duplicateParentState="true" works for you. When this attribute is set to true, the view gets its drawable state (focused, pressed, etc.) from its direct parent rather than from itself.

    <TextView
        android:layout_width="3dp"
        android:layout_height="match_parent"
        android:duplicateParentState="true"
        android:background="@drawable/selector_for_red" />