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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:19:45+00:00 2026-06-11T11:19:45+00:00

I create class A that extends AdapterView<ListAdapter>, and create class D that extends BaseAdapter

  • 0

I create class A that extends “AdapterView<ListAdapter>”, and create class D that extends “BaseAdapter” providing the data.

The problem is that every AdapterView item is not stretching its length to AdapterView’s length, and the length of each item is different as it is the same as the length of the text in the item. I set all layout parameters I can set to “FILL_PARENT”, but that does not make sense.

Which class should I check? The AdapterView subclass, or the BaseAdapter subclass, or the TextView subclass in AdapterView item? (I subclass TextView to get some extra effect).

The getView methods:

public View getView(int position, View convertView, ViewGroup viewGroup) {

    ViewHolder holder;
    if (convertView == null) {
        convertView = LayoutInflater.from(context).inflate(
                R.layout.colselector_menu_item, null);
        holder = new ViewHolder();

        convertView.setTag(holder);

        TextView tv = new VerticalTextView(viewGroup.getContext());
        tv.setTextColor(Color.RED);

        NewsInTimeApp app = (NewsInTimeApp) (((MainActivity) context)
                .getApplication());
        tv.setTextSize(Integer.parseInt(app.getConfig().get(
                AppConfig.CFGNAME_UI_MAIN_COLSELECTOR_TEXTSIZE)));
        ((LinearLayout) convertView).addView(tv);
        holder.groupItem = tv;

    } else {
        holder = (ViewHolder) convertView.getTag();
    }
    holder.groupItem.setText(list.get(position).getName());
    holder.collId = list.get(position).getId();

    return convertView;
}

The colselector_menu_item.xml :

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#e1e1e1"
android:orientation="horizontal" >

<View
android:layout_width="1dp"
android:layout_height="fill_parent"
android:background="@android:color/darker_gray"/>

</LinearLayout>
  • 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-11T11:19:46+00:00Added an answer on June 11, 2026 at 11:19 am

    When you are adding the view, you’re not specifying any layout parameters for the TextView itself.

    Try:

    (LinearLayout) convertView.addView(tv, LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
    

    If targeting API<8, change MATCH_PARENT to FILL_PARENT. This also assumes you do want them to wrap content vertically.

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

Sidebar

Related Questions

If I create a class that extends UserControl and want to set a default
In AS3 I create a number of playing cards through a class that extends
I'm trying to create a class that extends input stream Clojure via gen-class .
I have create a class MyConnection that extends NSURLConnection. I have implemented some delegate
I'm attempting to create a class that extends a CursorAdapter in order to display
I'm a starter at Java. I'd like to create a Form class that extends
I created a class that extends DefaultMutableTreeNode. It has a variable, resource of the
I created a class that extends ProfileBase: public class CustomerProfile : ProfileBase { public
I've created a class that extends Application. This class starts a service when the
I've created a Vector2D class that extends Point2D.Double . A Vector2D has two fields:

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.