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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:02:07+00:00 2026-06-05T06:02:07+00:00

I am trying to put table layout in list view in that table layout

  • 0

I am trying to put table layout in list view in that table layout i have one spinner which is not displaying properly it is stretched in width and doesn’t looks good. I am inflating the table layout in the getView() method of CustomAdapter which extends BaseAdapter

@Override
        public View getView(int position, View convertView, ViewGroup parent) {
            final int pos = position;
            final ViewHolder fHolder;
            ViewHolder holder ;
            View view = null;

            if(convertView == null) { // InflateViewHelper class is returning
                                     // object of View class In InflateViewHelper class
                                    //i have written
                                //View v = inflater.inflate(R.layout.table_layout, null); 

                InflateViewHelper inflateView = new InflateViewHelper(inflater, aShoppingItem.get(position), mContext);
                view = inflateView.createView();


                holder = new ViewHolder();
                holder.txtUnitPrice = (TextView) view.findViewById(R.id.txtUnitPrice);
                holder.txtTotalPrice = (TextView) view.findViewById(R.id.txtTotalPrice);
                holder.spinner = (Spinner) view.findViewById(R.id.spinner);

                view.setTag(holder);

            }
            else {

                view = convertView;
                holder = (ViewHolder)convertView.getTag();

            }
fHolder = holder;
            holder.spinner.setOnItemSelectedListener(
                    new OnItemSelectedListener() {

                        @Override
                        public void onItemSelected(AdapterView<?> parent, View view, int iposition, long id)
                        {

                            value = parent.getItemAtPosition(iposition).toString();

                            if( pos<totalItems.size())
                                totalItems.set(pos, value);
                            else
                                totalItems.add(pos,value);



                            int number = Integer.parseInt(value);
                            int unit = Integer.parseInt(fHolder.txtUnitPrice.getText().toString());
                            String total =  String.format("%d", unit*number);
                            fHolder.txtTotalPrice.setText(total);
                            String amnt = fHolder.txtTotalPrice.getText().toString();
                            Log.v("AMOUNT", amnt);

                            if( pos< totalAmount.size())
                                totalAmount.set(pos, amnt);
                            else
                                totalAmount.add(pos, amnt);

                        }

                        @Override
                        public void onNothingSelected(AdapterView<?> parent) {
                            totalItems.add(pos, value);
                            Log.v("VALUE@@@@", value);          
                        }

            });

            int number = Integer.parseInt(value);
            int unit =         Integer.parseInt(holder.txtUnitPrice.getText().toString());
            String total =  String.format("%d", unit*number);
            holder.txtTotalPrice.setText(total);

            return view;
        }

if i try this code in simple table layout it works properly
can any tell me where i am going wrong

  • 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-05T06:02:09+00:00Added an answer on June 5, 2026 at 6:02 am

    After a long time a got the solution for this problem.
    To get ride of this problem i have used a 9 patch image and put it as a background of spinner and i get slimmer spinner. I got this answer from this link

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

Sidebar

Related Questions

I'm trying to put an image in view section I have defined a table
I am trying to create a template that will put items in a table.
I am trying to put the list array(res) item in to the Data Table(_Hdt)
I am reading a table row from one page, and then trying to put
I'm not trying to put fuel on the table/div debate, for this project I've
I was trying to create a table dynamically and put textboxes in it. Here
I have multiple tables in a mysql database and I am trying to put
I trying to put together an Android app that will take a picture and
I'm trying to put a TextView and a ToggleButton in a table row, however,
I'm trying to put margins on the bottom of a table to separate it

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.