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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:48:30+00:00 2026-05-25T20:48:30+00:00

I have a custom list view which contains two text views and on button.

  • 0

I have a custom list view which contains two text views and on button.
I have customized the button style.
In the list view each row is not fit to show my button properly.
I want to change the list item’s height.
How can i do that..?

This is my list view.

<ListView android:layout_width="fill_parent"
        android:scrollbars="none" android:footerDividersEnabled="false"
        android:minHeight="50dp"
        android:listSelector="#00000000" android:dividerHeight="0px"
        android:divider="#00000000" android:layout_height="fill_parent"
        android:layout_marginLeft="5dp" android:layout_marginTop="5dp"
        android:layout_marginRight="5dp" android:id="@+id/list_view"
        android:cacheColorHint="#00000000" android:background="#00000000" />

my custom view xml

<?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="horizontal" android:layout_width="fill_parent"
    android:layout_height="wrap_content">

    <TextView android:layout_width="150dp"
        android:layout_height="wrap_content" 
        android:textColor="#808080" android:text="Subtitle 2" android:id="@+id/text1" 
        android:layout_marginLeft="5dp"
        android:singleLine="true"/>

    <TextView android:layout_width="60dp"
        android:layout_height="wrap_content" 
        android:textColor="#808080" android:text="$ 00.00" android:id="@+id/text2" 
        android:singleLine="true"/>

    <Button android:layout_width="80dp" android:layout_height="25dp"
        android:background="@drawable/type10_subbg" android:text="Add"
        android:textSize="20dp" android:textStyle="bold" android:textColor="#153E7E"
        android:id="@+id/add" />
</LinearLayout>   

Here is my getView.

@SuppressWarnings("unchecked")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
    ViewHolder holder;
    pos = position;
    holder = new ViewHolder();
    convertView = inflater.inflate(R.layout.type10_sub, null);          
    holder.text1 = (TextView) convertView.findViewById(R.id.text1);
    holder.text2 = (TextView) convertView.findViewById(R.id.text2);
    holder.add = (Button) convertView.findViewById(R.id.add);
    holder.add.setTag(String.valueOf(position));
    holder.add.setOnClickListener(new OnClickListener() {           
        @Override
        public void onClick(View v) {
            Button b = (Button)v;
            int tag = Integer.valueOf((String)b.getTag());
            System.out.println("Added at "+tag);
            System.out.println("Data = "+((HashMap<String,Object>)list.get(tag)).get("text1").toString());
            System.out.println("Price = "+((HashMap<String,Object>)list.get(tag)).get("text2").toString());             }
    });         holder.text1.setText(((HashMap<String,Object>)list.get(position)).get("text1").toString());
    holder.text2.setText(((HashMap<String,Object>)list.get(position)).get("text2").toString());
    convertView.setTag(holder);
    return convertView;
}

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-05-25T20:48:31+00:00Added an answer on May 25, 2026 at 8:48 pm

    convertedview.setlayoutparams(new Listview.setlayoutparams(width, height));

    First put LinearLayout instead of ListView

    and then edit that to ListView otherwise it will not work. This is the trick.

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

Sidebar

Related Questions

We have used Custom List View inside that one Text View and two Edit
I have made a custom listView which which extends ListActivity and each row contains
I have implemented a custom list view which looks like the twitter timeline. adapter
I have a custom cell that contains a button in a table view. The
In my application i have used list view and custom cell which contain product
I have a listview which I am populating with a custom SimpleCursorAdapter, each row
I am running WSS3.0 and have a custom list which contains versioning on a
I have a ListView which contains custom rows. This custom row has following UI
I have a listview with 200 items. I use a custom view for each
I have a strongly typed view of type ProductListingViewModel which in turn contains a

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.