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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:19:27+00:00 2026-06-16T02:19:27+00:00

I am trying to make it so the the last row and first row

  • 0

I am trying to make it so the the last row and first row of my listview will have rounded edges. Right now I am just trying to get the first row to have rounded edges. I able to accomplish this but a few random rows usually the 5-7 and 15 or 16th rows will be set to the rounded edges background too and I can’t figure out why.

Here is the part of my adapter code where I try to set the rounded edges drawable:

public View getView(int position, View convertView, ViewGroup parent) {
    View vi = convertView;

    if (convertView == null) {
        vi = inflater.inflate(R.layout.row, null);
        holder = new ViewHolder();
        holder.title = (TextView) vi.findViewById(R.id.title);
        holder.desc = (TextView) vi.findViewById(R.id.details);
        holder.date = (TextView) vi.findViewById(R.id.date);
        holder.price = (TextView) vi.findViewById(R.id.price);
        holder.location = (TextView) vi.findViewById(R.id.location);
        holder.newImage = (ImageView) vi.findViewById(R.id.savedNewItemsRibbon);
        holder.rellay = (RelativeLayout) vi.findViewById(R.id.widget30);

        //holder.image = (ImageView) vi.findViewById(R.id.thumb);
        vi.setTag(holder);
    }else{
        holder = (ViewHolder) vi.getTag();
    }
    if(position == 0 && firstRow){
        holder.rellay.setBackgroundResource(R.drawable.roundededges);
        firstRow = false;
    }else{
        //vi.setBackgroundColor(Color.WHITE);
    }


    Log.d("MySQL", "COunt:"+position);
    holder.price.setText(data.get(position).getPrice());
    holder.location.setText(data.get(position).getUrl());

    datasource = new PostDataSource(activity);
    datasource.open();

    if(datasource.checkIfNew(data.get(position).getTitle())){
        holder.newImage.setVisibility(View.VISIBLE);
        //vi.setBackgroundColor(Color.YELLOW);

    }else{
        holder.title.setTextColor(Color.BLACK);
    }
    holder.title.setText(data.get(position).getTitle());

    holder.desc.setText(data.get(position).getDescription());
    holder.date.setText(data.get(position).getPubDate());
    holder.location.setText(data.get(position).getCity());


    //holder.title.setText(data.get(0).getTitle());
    //imageLoader.DisplayImage((data.get(position).getThumbnail()), activity,holder.image, 72, 72);


    URL url = null;
    try {
        url = new URL((data.get(position).getThumbnail()));
    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    InputStream content = null;


    /*
    try {
        //content = (InputStream)url.getContent();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }


    Drawable d = Drawable.createFromStream(content , "src"); 
    Bitmap mIcon1 = null;
     try {
         mIcon1 =
                BitmapFactory.decodeStream(url.openConnection().getInputStream());
    } catch (IOException e) {
        e.printStackTrace();
    }
    holder.image.setImageBitmap(Bitmap.createScaledBitmap(mIcon1, 72, 72, false));
     */
    positionCount++;
    return vi;

}

I’ve tried just using position==0 to set it to no avail. Any ideas?

  • 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-16T02:19:28+00:00Added an answer on June 16, 2026 at 2:19 am

    This is most likely because the framework is passing a non-null convertView into your getView method, which happens to come from your first row.

    The easiest fix is to unset the background resource for every row but the first:

       if (position == 0){
           holder.rellay.setBackgroundResource(R.drawable.roundededges);
       } else {
           holder.rellay.setBackgroundResource(0);
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Consider the following Fiddle: http://jsfiddle.net/wNrqu/ For the last 4 hours I have been trying
I'm trying make my first python app. I want make simple email sender form.
I have been trying to make something work with JQuery. I have the following
I'm trying to make a Procedure that will duplicate multiple rows of a table
I have the following class that I'm trying to make persistent, and am getting
I'm trying to user JQuery to make a table row clickable and redirect to
I'm trying to make a simple navigation that will be served on mobile devices
I'm trying to make my table view remember it's last position, so that after
I am trying to make a form in which there will be a button,
I have a row of images that are moving left or right with animate().

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.