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

  • Home
  • SEARCH
  • 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 8155101
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T16:34:19+00:00 2026-06-06T16:34:19+00:00

I have a ListView that contains 1 image+2 texts + 1 image on a

  • 0

I have a ListView that contains 1 image+2 texts + 1 image on a line. This is my xml for listview :

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_height="20dp"
   android:gravity="left|center"
   android:layout_width="wrap_content"
   android:paddingLeft="5dp"
   android:paddingRight="5dp"
   android:background="@color/list_bg"
   >

    <ImageView
       android:id="@+id/avatar"
       android:layout_width="wrap_content"
       android:layout_height="48dp"
       android:layout_marginTop="10dp"
       android:layout_alignParentLeft="true"/>

    <LinearLayout
       android:orientation="vertical"
       android:layout_width="wrap_content"
       android:layout_height="48dp"
       android:layout_toRightOf="@+id/avatar"
       android:layout_marginLeft="5dp"
       android:layout_marginTop="5dp"
       >


    <TextView android:id="@+id/listitem1"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_marginTop="2dp"
      android:textColor="@drawable/textblack_selected"
      android:textSize="18dp"
      android:textStyle="bold" 
      />
    <TextView android:id="@+id/listitem2"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textColor="@drawable/textorange_selected"
      />

    </LinearLayout>

    <ImageView
       android:id="@+id/arrowImage"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_marginTop="25dp"
       android:layout_alignParentRight="true"
       android:src="@drawable/arrow_selector"/>
</RelativeLayout>

I need to remove the last image(the arrow) from the last line. In my adapter I tried to use this :

if (position == 4) lastimg.setImageResource(0);

but nothing changed.Here is my adapter:

public class UserItemAdapter extends ArrayAdapter < UserRecord > {
    private ArrayList < UserRecord > users;

    public UserItemAdapter(Context context, int textViewResourceId, ArrayList < UserRecord > users) {
        super(context, textViewResourceId, users);
        this.users = users;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View v = convertView;
        if (v == null) {
            LayoutInflater vi = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            v = vi.inflate(R.layout.mainmenurowlist, null);
        }

        UserRecord user = users.get(position);
        if (user != null) {
            TextView listitem1 = (TextView) v.findViewById(R.id.listitem1);
            TextView listitem2 = (TextView) v.findViewById(R.id.listitem2);

            if (listitem1 != null) {
                listitem1.setText(user.listitem1);
            }

            if (listitem2 != null) {
                listitem2.setText(user.listitem2);
            }
        }

        firstimg = (ImageView) v.findViewById(R.id.avatar);
        lastimg = (ImageView) v.findViewById(R.id.arrowImage);

        firstimg.setImageResource(FirstImage[position]);
        if (position == 4) {
            lastimg.setImageResource(0);
            System.out.println("Exit!!");
        }
        return v;
    }
}

public class UserRecord {
    public String listitem1;
    public String listitem2;

    public UserRecord(String listitem1, String listitem2) {
        this.listitem1 = listitem1;
        this.listitem2 = listitem2;
    }
}
} 

Has anyone any idea how can I solve this? Thanks in advance.

  • 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-06T16:34:21+00:00Added an answer on June 6, 2026 at 4:34 pm

    try like this

    if(position == (data_id.size()-1))
    {
      lastimg.setVisibility(View.INVISIBLE);
    }
    

    here data_id is just an array list

    or try as below

    if(position == 4)
    {
      lastimg.setVisibility(View.INVISIBLE);
    }
    

    both are to be same

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

Sidebar

Related Questions

I have a window that uses a viewmodel. This screen contains 2 listviews on
I have a listview that contains values from webservice.Each page contains only 10 listitems
I have a ListView that contains some data from sqllite table. the table is
I have a Custom ListView that contains a vertical LinearLayout of horizontal LinearLayouts for
I have a ListView that contains 3 checkboxes per row. I want to set
I have a ListView that contains playlists. If the user wants to edit an
I have a ListView than contains a list of image created from web link
I have a ListView that contains a list of TextViews, and in my onItemClick()
I have a WPF ListView that contains CheckBox column and other columns of the
I have a layout with a ListView that contains EditText objects that can requestFocus()

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.