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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:11:29+00:00 2026-05-23T15:11:29+00:00

I have achieved something similar for particular items within my ListView in this question.

  • 0

I have achieved something similar for particular items within my ListView in this question.

However, now, I want the user to be able to click on items, which will essentially highlight any item the user has tapped. I keep a list of the tapped items in my application, and should be able to reference this from the ViewBinder when scrolling occurs, however, since I am never adapting anything to the LinearLayout that makes up the ListView itself, I am not sure how to get the LinearLayout object in order to properly set its background color.

I need to be able to do this, because as you may know, when scrolling, Android re-uses the list items, which is fine unless you are changing formatting (coloring, etc.) of individual list items. In that case, you end up with list items that are colored/formatted incorrectly. I am using a ViewBinder to solve the issue when it comes to the TextViews within my list items, but do not know how to do something similar for the background of the ListView itself.

  • 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-05-23T15:11:30+00:00Added an answer on May 23, 2026 at 3:11 pm

    Create a custom row layout- e.g. custom_row.xml, and arrange any views needed, just as you would in a normal layout for an activity (so in this case you would probably provide a textview for the text, and perhaps an icon to the left of it).

    Then create your custom adapter by extending an existing adapter, and override the getView method as such. Here’s an example that uses a layout custom_row with both a title and subtitle:

    class CustomAdapter<T> extends ArrayAdapter<T> {
    
    /** List item title */
    protected TextView mTitle;
    /** List item subtitle */
    protected TextView mSubtitle;
    
    /**
     * @param context
     *            Current context
     * @param items
     *            Items being added to the adapter
     */
    public CustomAdapter(final Context context, final List<T> items) {
        super(context, R.layout.custom_row, items);
    }
    
    /** Construct row */
    @Override
    public View getView(final int position, final View convertView, final ViewGroup parent) {
        View view = convertView;
        if (view == null) {
            final LayoutInflater li = (LayoutInflater) getContext().getSystemService(
                    Context.LAYOUT_INFLATER_SERVICE);
            view = li.inflate(R.layout.custom_row, null);
        }
        mTitle = (TextView) view.findViewById(R.id.custom_row_title);
        mSubtitle = (TextView) view.findViewById(R.id.custom_row_subtitle);
        return view;
    }
    }
    

    As demonstrated, you can grab the items specified in the custom_row layout you created through the inflater service. Then you can manipulate the objects as needed.

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

Sidebar

Related Questions

I want to achieve something like this inside a UIView: I have created a
I want to have achieve something similar to Java Tiles framework using only client
All source files seem to have compiled fine. However, since I achieved that, I
So I asked something similar yesterday and did receive an answer to my question,
I have an unordered list of items, I want to display each item as
Sorry I know similar question have been asked many times before but like most
This question is related to: Does Nvidia Cuda warp Scheduler yield? However, my question
im trying to achieve something but i dont really know how I have set
I need to used dynamic order query in mysql and i have successfully achieved
Here is what I want to achieve: I have RadGridView, let's call it gridView,

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.