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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:06:00+00:00 2026-06-14T23:06:00+00:00

I have listView , each row of which is looking like that: <?xml version=1.0

  • 0

I have listView , each row of which is looking like that:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:orientation="horizontal"
    android:padding="5dip" 
    android:background="#FFFFFF">
    <LinearLayout
        android:id="@+id/thumbnail"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_marginRight="5dip"
        android:padding="3dip" >

        <TextView
            android:id="@+id/altOrderId"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="ID"
            android:gravity="center|center"
            android:textColor="#040404"
            android:textSize="15dp"
            android:textStyle="bold"
            android:typeface="sans" />
    </LinearLayout>

    <TextView
        android:id="@+id/altOrderTitle"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_marginTop="1dip"
        android:textStyle="bold"
        android:layout_toRightOf="@+id/thumbnail"
        android:text="Just gona stand there and ..."
        android:textColor="#000000"
        android:textSize="14dp" />

    <TextView
        android:id="@+id/altOrderStatus"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/altOrderTitle"
        android:layout_alignParentBottom="true"
        android:layout_marginRight="5dip"
        android:layout_toRightOf="@+id/thumbnail"
        android:textColor="#838B8B"
        android:textSize="14dp"
        android:textStyle="bold" />

    <TextView
        android:id="@+id/altOrderPrice"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_alignTop="@+id/thumbnail"
        android:text="Rihanna Love the way lie"
        android:textColor="#458B74"
        android:textSize="15dp"
        android:textStyle="bold"
        android:typeface="sans" />

</RelativeLayout>

My adapter class is:

public class OrderAdapter extends ArrayAdapter<Order>{


    Context context; 
    int layoutResourceId;    
    public static int rowHeight = 0;
    List<Order> orders = null;
    private Activity activity;
    public OrderAdapter(Context context,  int layoutResourceId,List<Order> orders) {
        super(context, layoutResourceId, orders);
        this.layoutResourceId = layoutResourceId;
        this.context = context;
        this.orders = orders;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View row = convertView;
        OrderHolder holder = null;

        if(row == null)
        {


            LayoutInflater inflater = (LayoutInflater)this.context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            row = inflater.inflate(R.layout.dash_alt_item, parent, false);
            row.setBackgroundColor(Color.WHITE);
            //row.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT,30));
            holder = new OrderHolder();
            holder.orderId = (TextView)row.findViewById(R.id.altOrderId);
            holder.orderTitle = (TextView)row.findViewById(R.id.altOrderTitle);
            holder.orderStatus = (TextView)row.findViewById(R.id.altOrderStatus);
            holder.orderPrice = (TextView)row.findViewById(R.id.altOrderPrice);

            row.setTag(holder);
        }
        else
        {
            holder = (OrderHolder)row.getTag();
        }

        Order order = orders.get(position);
        holder.orderId.setText(Integer.toString(order.getOrderid()));
        holder.orderTitle.setText(order.getTitle());
        holder.orderStatus.setText(order.getProcess_status().getProccessStatusTitle());
        holder.orderPrice.setText(Float.toString(order.getPrice()));

        return row;
    }

    static class OrderHolder
    {
        TextView orderId;
        TextView orderTitle;
        TextView orderStatus;
        TextView orderPrice;
    }
}

I need to detect(or set) height of the each of listview’s row and display corresponding quantity of the items to the device screen height. How can I implement it?

  • 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-14T23:06:01+00:00Added an answer on June 14, 2026 at 11:06 pm

    use gridview instead of listview, and set this android:numColumns="auto_fit" >

    <GridView
            android:id="@+id/gridView1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:numColumns="auto_fit" >
        </GridView>
    

    To getheight of screen

    Display display = getWindowManager().getDefaultDisplay();
    Point size = new Point();
    display.getSize(size);
    int width = size.x;
    int height = size.y;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a custom ListView in which each row.xml looks like this: <LinearLayout xmlns:android=http://schemas.android.com/apk/res/android
I have an xml layout which I use for each row in my listview:
I have a listview with custom rows and that extends SimpleAdapter. Each row consist
I have a ListView which I've created a custom view for each row. My
I have a listview which loads its data from sqlite database. Each row in
I have a ListView which is taking data from DB. Each row when clicked
I have made a custom listView which which extends ListActivity and each row contains
In Android I would like to have a ListView control that lists various categories
I have a custom adapter populating a listview. Each row has a checkbox which
Basically, I have a custom ListView in which each item looks like: <LinearLayout> <Table>

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.