Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8768147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T16:59:55+00:00 2026-06-13T16:59:55+00:00

I have a list view with items that hold 2 views each(this ListView looks

  • 0

I have a list view with items that hold 2 views each(this ListView looks like a GridView with 2 columns).
I needed the header and the footer and they are not available in the GridView, so I turned to using list view.

I want a selector for individual child view of each list item, the list selector did not work, it applies the selector to both child views.

What I have tried so far ????

I make the root view of each single element a FrameLayout and I use the android:foreground="@drawable/some_selector" attribute so I can simulate the drawSelectorOnTop attribute.

My Problem :

How can I apply the selector only to the pressed child in the listview item.

list view layout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent" >

    <ListView
        android:id="@+id/episode_list"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:divider="@android:color/black"
        android:dividerHeight="5dp"
        android:listSelector="@null"
        android:descendantFocusability="afterDescendants" />

</RelativeLayout>

episode item

<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:clickable="true"
    android:foreground="@drawable/all_show_cell_background_selector" >

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/llEpisode"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#282828"
        android:paddingBottom="5dp" >

        <ImageView
            android:id="@+id/episodeImage"
            android:layout_width="160dp"
            android:layout_height="90dp"
            android:layout_alignParentLeft="true"
            android:layout_alignParentRight="true"
            android:layout_gravity="center_vertical|center_horizontal"
            android:adjustViewBounds="true"
            android:contentDescription="@string/app_name"
            android:scaleType="centerCrop"
            android:src="@drawable/video_blank" />

        <TextView
            android:id="@+id/episodeDuration"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@id/episodeImage"
            android:layout_alignLeft="@id/episodeImage"
            android:background="@android:color/black"
            android:gravity="right"
            android:padding="2dp"
            android:textColor="#FFFFFF"
            android:textSize="11sp" />
        <!-- android:textColor="#b5b4b4" -->

        <TextView
            android:layout_marginTop="2dp"
            android:id="@+id/episodeTitle"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/episodeImage"
            android:gravity="right"
            android:paddingRight="5dp"
            android:singleLine="true"
            android:text="hdgsagafasfsdafsdfsdfasddfsad"
            android:textColor="#ffffff"
            android:textSize="14sp" >

        </TextView>

        <TextView
            android:id="@+id/showName"
            android:layout_marginTop="2dp"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentLeft="true"
            android:layout_below="@+id/episodeTitle"
            android:clickable="true"
            android:gravity="right"
            android:paddingRight="5dp"
            android:text="hdgsagafasfsdafsdfsdfasddfsad"
            android:textColor="#A8A8A8"
            android:textSize="13sp" >

        </TextView>

        <TextView
            android:layout_marginTop="2dp"
            android:id="@+id/noOfViewsText"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentRight="true"
            android:layout_below="@+id/showName"
            android:layout_alignParentBottom="true"
            android:gravity="right"
            android:paddingRight="5dp"
            android:text="@string/number_of_views_text"
            android:textColor="#A8A8A8"
            android:textSize="11sp" />

        <TextView
            android:id="@+id/episodeNumberOfViews"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/noOfViewsText"
            android:layout_toLeftOf="@+id/noOfViewsText"
            android:layout_toRightOf="@+id/fav_img"
            android:ellipsize="none"
            android:gravity="right"
            android:paddingRight="5dp"
            android:singleLine="true"
            android:text="fsdafasdfsad"
            android:textColor="#A8A8A8"
            android:textSize="11sp" />

        <ImageView
            android:id="@+id/fav_img"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignBottom="@+id/episodeNumberOfViews"
            android:layout_alignParentLeft="true"
           android:layout_marginLeft="4dp"
            android:contentDescription="@string/favourite_title_show"
            android:src="@drawable/fav_episode" />
    </RelativeLayout>

</FrameLayout>

the single list item contains 2 episode items

this is the container that holds the 2 episode items

 <?xml version="1.0" encoding="utf-8"?>
    <!-- This container to help emulate a GridView in each ListView item -->
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:descendantFocusability="afterDescendants"
        android:orientation="horizontal" >

    </LinearLayout>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T16:59:57+00:00Added an answer on June 13, 2026 at 4:59 pm

    I face this problem before , and have a nice solution look here for sample code

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a list view that displays a collection of items, each item has
I have a list view full of items that contain multiple widgets each such
I have created a list view that displays the names and dates of items
I have a listview with several items that are created dynamically, each has two
I have a list of items that are displayed using a ListView from a
how to see items that i pick on ListView ? i have this code:
I have a list view with over 100 items. Each of these items show
I have a list view control that users can add items to but I
I have a list view in which I add items dynamically. I want that
I have a ListView that shows around 300 items. When something is changed and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.