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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:26:38+00:00 2026-05-22T03:26:38+00:00

today i tried to make my listview a bit more dynamic. So i created

  • 0

today i tried to make my listview a bit more dynamic. So i created a white ninepatch-image and added a colorfilter with the .setColorFilter method. That’s not the problem.
But after applying this, everytime i scroll the Image is scaling wrong (randomly) so lets say my item is 100dp high with some text. After scrolling the item is still 100dp high and all text is shown but the image in the Background only uses 50dp now.

Here’s my code:

here how i set the Colorfilter:

orgleftbox = context.getResources().getDrawable(R.drawable.list_bubble);
orgleftbox.setColorFilter( 0xff00c0ff, Mode.MULTIPLY );

and here how i add it in my adapter

v = inflater.inflate(R.layout.list_view_item, null);            
TextView t = (TextView)v.findViewById(R.id.text);
t.setBackgroundDrawable(orgrightbox);

I hope someone could help me. Because this bug is annoying me ;(

  • 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-22T03:26:39+00:00Added an answer on May 22, 2026 at 3:26 am

    i was able to fix my problem on my own. So i answer this for everybody else ;).

    The problem was that i loaded my drawable once in the constructor, because i thought so i won’t have to load it for each listitem new. But the android-system handles them as the same memory object. so every listitem-background uses the same mem-space (i hope it isn’t wrong, i think so). If i start scrolling the next listitem will be declared and changes the height and width of its background to its needs, example the next item is only 50dp high it changes the saved value to this one. Now every other background of the list will change more or less to this height too.

    The simple fix is, that you have to load and apply the colorfilter for each item new. espec. in the getView Method.

    @Override
    public View getView(int pos, View convertView, ViewGroup parent) {
        View v = null;
        leftbox = (NinePatchDrawable) r.getDrawable(R.drawable.bubble_green);
        leftbox.setColorFilter( 0xff00c0ff, Mode.MULTIPLY );
    
        v = inflater.inflate(R.layout.list_view_item_right, null);
        TextView t = (TextView)v.findViewById(R.id.text);
        t.setBackgroundDrawable(leftbox);
    

    i hope this answer was useful.

    EDIT (Thousand times simpler):

    If you only want to apply a colorFilter to a Layout(Textview…) do it this way (thanks Pasha):

    TextView t = (TextView)v.findViewById(R.id.text);
    t.getBackground().setColorFilter(0xff00c0ff, Mode.MULTIPLY );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Today I encountered something strange: I tried to put a utility method into an
I just got started today developing for Android. I tried to make an application
EDIT question to make it understandable . Today I tried to do a programm
Today I tried to use the publishing feature with visual studio, which creates an
Today I tried including the apache.commons.codec package in my Android application and couldn't get
Today at work someone tried to convince me that: {$obj->getTableInfo()} is fine for smarty/mvc/templating
I tried backing up our site today using the Unix 'cp' command and ended
I tried using PHPDoc for the first time today and quickly ran into a
I downloaded today Subsonic 3 and tried out the examples. I am having a
Today I was working on a tab navigation for a webpage. I tried the

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.