2

Good Day, I am trying to create a Navigation Drawer with ListView and few more views.

My issue is when i try to click on the other view the click doesn't register

Can you please tell me if i can create a complex view structure as the navigation drawer?

<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent" >

<!-- The main content view -->

<FrameLayout
    android:id="@+id/content_frame"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />
<!-- The navigation drawer -->

<LinearLayout
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@color/charcoal"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:orientation="vertical"
    android:showDividers="middle" >

    <ListView
        android:id="@+id/home_drawer_lv_accounts"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:choiceMode="singleChoice"
        android:divider="@color/amazon"
        android:dividerHeight="5dp" >
    </ListView>

    <CheckedTextView
        android:id="@+id/home_drawer_cv_banks"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:background="@color/health"
        android:focusable="true"
        android:gravity="center"
        android:text="@string/text_all_banks"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:textColor="#FFF" />
</LinearLayout>

</android.support.v4.widget.DrawerLayout>
Squonk
  • 48,735
  • 19
  • 103
  • 135
Mustafa ALMulla
  • 870
  • 2
  • 10
  • 23

1 Answers1

-1

Modify ur xml as follows

<LinearLayout
    android:id="@+id/left_drawer"
    android:layout_width="240dp"
    android:layout_height="match_parent"
    android:layout_gravity="start"
    android:background="@color/charcoal"
    android:divider="@android:color/transparent"
    android:dividerHeight="0dp"
    android:orientation="vertical"
    android:showDividers="middle" >

    <RelativeLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent" >

        <ListView
            android:id="@+id/home_drawer_lv_accounts"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:background="@android:color/holo_red_light"
            android:choiceMode="singleChoice"
            android:divider="@android:color/black"
            android:dividerHeight="5dp" >
        </ListView>

        <CheckedTextView
            android:id="@+id/home_drawer_cv_banks"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:background="@android:color/holo_red_light"
            android:focusable="true"
            android:text="Some Dummy Text"
            android:textAppearance="?android:attr/textAppearanceLarge"
            android:textColor="#FFF" />
    </RelativeLayout>
</LinearLayout>
Harsha Vardhan
  • 3,324
  • 2
  • 17
  • 22