0

Hi i am using a navigation drawer as below..Im using this with ABS

<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">

    <!-- As the main content view, the view below consumes the entire
         space available using match_parent in both dimensions. -->
    <FrameLayout
        android:id="@+id/content_frame"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

    <!-- android:layout_gravity="start" tells DrawerLayout to treat
         this as a sliding drawer on the left side for left-to-right
         languages and on the right side for right-to-left languages.
         The drawer is given a fixed width in dp and extends the full height of
         the container. A solid background is used for contrast
         with the content view. -->
    <ListView
        android:id="@+id/left_drawer"
        android:layout_width="300dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:divider="@android:color/darker_gray"
        android:dividerHeight="1dp"
        android:background="#ffffff"
        />
</android.support.v4.widget.DrawerLayout>

But the issue is when i click the list item i don get it highlighted like that item is selected whenever drawer is opened..i.e i need selected item to be highlighted whenever drawer is opended until next item ln list is clicked.. Just like google play

user1340801
  • 423
  • 3
  • 10
  • 21

1 Answers1

0

You answer is here:

Android ListView selected item stay highlighted

but, for example, try this in your main.java:

listView.setOnItemClickListener(new OnItemClickListener(){
    @Override
    public void onItemClick(AdapterView<?> parent, View view, int position,long arg3) {
        view.setBackgroundColor(A COLOR FOR EXAMPLE);
    }
}
Community
  • 1
  • 1