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 7836113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:58:40+00:00 2026-06-02T13:58:40+00:00

The problem: I have a ListView item with a relatively complex layout. One of

  • 0

The problem:

I have a ListView item with a relatively complex layout. One of the children in the list item view is a TextView with links. The TextView can handle the clicks on links found in it(by using Linkify), and has a OnClickListener that handles click on parts of the text that are not links. The listener will just get the position of the view in the ListView and perform a click:

@Override
public void onClick(View v) {
    int position = mListView.getPositionForView(v);
    mListView.performItemClick(v, position, mAdapter.getItemId(position));
}

Everything works fine, except the click doesn’t trigger the ListView to update the list item’s drawable state. It does trigger that when you click on other TextViews in the item that are not clickable.

Thanks!

  • 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-02T13:58:41+00:00Added an answer on June 2, 2026 at 1:58 pm

    Got it working.

    Set the list item view clickable and set its background as a state-list drawable, also set addStatesFromChildren to true. This will make sure the state of the list view item is changed when any of its children is clicked(assume the child is clickable).

    However, this will cause the ListView itself not receiving focus, so you need to handle the click by adding View.OnClickListener to the list item itself instead of adding a OnItemClickedListener to the ListView.

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

Sidebar

Related Questions

I have a problem with setting the click event in a list view item.
I have a ListView in which each item has a complex layout that contains,
I have a big problem: I have a listview and each item links to
I have a little problem with a Listview. I can load it with listview
I have problem adding arraylist to list view, will explain about my problem here..
In one of my Activities I have a ListView that displays a list of
i have a listView with a custom BaseAdapter.Every list item has a clickable button.
I have a listview and when you click an item in the list I
I'm having the following problem: I have a ListView and I get the layout
I have a ListView and on clicking a list item, it starts another activity.

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.