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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:17:06+00:00 2026-06-06T19:17:06+00:00

I have created a table layout in which my table row height is too

  • 0

I have created a table layout in which my table row height is too small, so I want to increase the height of the table row , please guide me table is dynamically created so I don’t have any idea.

Code: I have tried to specify width in Latoutparam integer but not working

public void createTableLayout()
{
    String status="Pending";
    TextView txtid=(TextView)findViewById(R.id.txtcid);
    //TextView txtdate=(TextView)findViewById(R.id.txtDate);
    txtid.setText("Customer Id/Name : "+shopnum+"/"+shopname1);
    btnorder1=(Button)findViewById(R.id.btnOrder123);
    btnBack1=(Button)findViewById(R.id.btnBack1);
    txtTotalAmount=(TextView)findViewById(R.id.txtTotalAmt);
    btnorder1.setOnClickListener(new View.OnClickListener()
    {       
        @Override
        public void onClick(View v) 
        {
            ShowcOrder1();
            int rcount=(table).getChildCount();
            SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
            String currentDateandTime = sdf.format(new Date());
            for(int r=1;r<rcount;r++)
            {
                TableRow row=(TableRow)table.getChildAt(r);
                int vcount=(row).getChildCount();
            //  String str=
                for(int v1=0;v1<vcount;v1++)
                {
                    TextView tv = (TextView)(((TableRow)row)).getChildAt(v1);


    insertIntoOrderDetails(String.valueOf(orderid),ProdcutId,PackageId,Quantity);
                }
                insertIntoOrder(String.valueOf(orderid), currentDateandTime, shopnum,String.valueOf(roundtotal), sid);
                Toast.makeText(getApplicationContext(), "Order Placed",Toast.LENGTH_LONG).show();
                finish();
            //  Toast.makeText(getApplicationContext(), "round: "+roundtotal,Toast.LENGTH_LONG).show(); 
            }

        });

        btnBack1.setOnClickListener(new View.OnClickListener()
        {   
            @Override
            public void onClick(View arg0) 
            {
                // TODO Auto-generated method stub
                finish();
            }
        });

        //txtdate.setText("Order Date is : "+odate);
            table = (TableLayout) findViewById(R.id.tbpastorderdetails);
            TableRow tr_heading = new TableRow(Pastorder.this);
            tr_heading.setId(10);
            tr_heading.setBackgroundColor(Color.BLACK);
            tr_heading.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));

            TextView label_product_id = new TextView(Pastorder.this);
            label_product_id.setId(20);
            label_product_id.setText("PID");
            label_product_id.setTextColor(Color.WHITE);
            //label_question.setPadding(2, 2, 2, 2);
            // label_date.setPadding(5, 5, 5, 5);
            tr_heading.addView(label_product_id); // add the column to the table row

            //TextView label_question = new TextView(this);
            TextView label_package_id = new TextView(Pastorder.this);
            label_package_id.setId(20);
            label_package_id.setText("  Pack.ID");
            label_package_id.setTextColor(Color.WHITE);
            //label_question.setPadding(2, 2, 2, 2);
            // label_date.setPadding(5, 5, 5, 5);
            tr_heading.addView(label_package_id); // add the column to the table row


            //TextView label_question = new TextView(this);
            TextView label_product = new TextView(Pastorder.this);
            label_product.setId(20);
            label_product.setText(" PRODUCT");
            label_product.setTextColor(Color.WHITE);
            //label_question.setPadding(2, 2, 2, 2);
            // label_date.setPadding(5, 5, 5, 5);
            tr_heading.addView(label_product); // add the column to the table row
                                                // here
        //  Toast.makeText(ExaminationActivity.this,"hi try ",Toast.LENGTH_LONG).show();
            //TextView label_answer = new TextView(this);
            TextView label_catagory = new TextView(Pastorder.this);
            label_catagory.setId(21);// define id that must be unique
            label_catagory.setText("    CATAGORY"); // set the text for the header
            label_catagory.setTextColor(Color.WHITE); // set the color
            // label_weight_kg.setPadding(5, 5, 5, 5); // set the padding (if
            // required)
        //  label_weight_kg.setPadding(2, 2, 2, 2);
            tr_heading.addView(label_catagory); // add the column to the table row
                                                    // here


            //TextView label_youranswer = new TextView(this);
            TextView label_package = new TextView(Pastorder.this);
            label_package.setId(20);
            label_package.setText(" PACKAGE");
            label_package.setTextColor(Color.WHITE);
            //label_question.setPadding(2, 2, 2, 2);
            // label_date.setPadding(5, 5, 5, 5);
            tr_heading.addView(label_package); // add the column to the table row
                                                // here
            TextView label_weight = new TextView(Pastorder.this);
            label_weight.setId(20);
            label_weight.setText("  WEIGHT");
            label_weight.setTextColor(Color.WHITE);
            //label_question.setPadding(2, 2, 2, 2);
            // label_date.setPadding(5, 5, 5, 5);
            tr_heading.addView(label_weight); // add the column to the table row

            TextView label_qty = new TextView(Pastorder.this);
            label_qty.setId(20);
            label_qty.setText(" QUANTITY");
            label_qty.setTextColor(Color.WHITE);
            //label_question.setPadding(2, 2, 2, 2);
            // label_date.setPadding(5, 5, 5, 5);
            tr_heading.addView(label_qty); // add the column to the table row

            TextView label_amt = new TextView(Pastorder.this);
            label_amt.setId(20);
            label_amt.setText(" AMOUNT");
            label_amt.setTextColor(Color.WHITE);
            //label_question.setPadding(2, 2, 2, 2);
            // label_date.setPadding(5, 5, 5, 5);
            tr_heading.addView(label_amt); // add the column to the table row       
            table.addView(tr_heading, new TableLayout.LayoutParams(
                    LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
        }

public void addRows()
{
    try
    {               
        msaledb = openOrCreateDatabase(DBNAME, Context.MODE_PRIVATE,null);
        Cursor allrows  = msaledb.rawQuery("SELECT * FROM " + PRODUCT_TABLE+" WHERE Product_ID = '" + pid +"'", null);
        Cursor allrows1  = msaledb.rawQuery("SELECT * FROM " + PACKAGING_TABLE ,null);
        if(allrows.moveToFirst() && allrows1.moveToFirst())// && allrows1.moveToFirst())
         {         
            int i=1;    
            do
            {   
                tr = new TableRow(Pastorder.this);
                tr.setId(i);
                tr.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));

                TextView tvpid = new TextView(Pastorder.this);
                tvpid.setId(11);
                tvpid.setText(""+pid);
                tvpid.setPadding(2, 0, 5, 0);
                tvpid.setTextColor(Color.BLACK);
                tr.addView(tvpid);

                TextView tv_pack_id = new TextView(Pastorder.this);
                tv_pack_id.setId(12);
                tv_pack_id.setText("    "+packid);
                tv_pack_id.setPadding(2, 0, 5, 0);
                tv_pack_id.setTextColor(Color.BLACK);
                tr.addView(tv_pack_id);

                TextView tv = new TextView(Pastorder.this);
                tv.setId(1);
                tv.setText("    "+allrows.getString(2));
                tv.setPadding(2, 0, 5, 0);
                tv.setTextColor(Color.BLACK);
                tr.addView(tv);
                TextView tv1 = new TextView(Pastorder.this);
                tv1.setId(2);
                tv1.setText("   "+allrows.getString(3));
                tv1.setPadding(2, 0, 5, 0);
                tv1.setTextColor(Color.BLACK);
                tr.addView(tv1);
                do
                {
                if(allrows1.getString(1).trim().equals(packid.trim()) && allrows1.getString(2).trim().equals(pid.trim()))
                {
//                      Toast.makeText(getApplicationContext(), ""+allrows1.getString(2).trim(),Toast.LENGTH_LONG).show();
//                      Toast.makeText(getApplicationContext(), ""+p_id.get(0).trim(),Toast.LENGTH_LONG).show();
                        TextView tv2 = new TextView(Pastorder.this);
                        tv2.setId(3);
                        tv2.setText("   "+allrows1.getString(3));
                        tv2.setPadding(2, 0, 5, 0);
                        tv2.setTextColor(Color.BLACK);
                        tr.addView(tv2);                        
                        TextView tv3 = new TextView(Pastorder.this);
                        tv3.setId(4);
                        tv3.setText("   "+allrows1.getString(4));
                        tv3.setPadding(2, 0, 5, 0);
                        tv3.setTextColor(Color.BLACK);
                        tr.addView(tv3);                        
                        TextView tv4 = new TextView(Pastorder.this);
                        tv4.setId(4);
                        tv4.setText("   "+qty);
                        tv4.setPadding(2, 0, 5, 0);
                        tv4.setTextColor(Color.BLACK);
                        tr.addView(tv4);                        
                        TextView tv5 = new TextView(Pastorder.this);
                        tv5.setId(4);
                        tv5.setText("   "+Integer.parseInt(allrows1.getString(6).trim())*Integer.parseInt(qty.trim()));
                        tv5.setPadding(2, 0, 5, 0);
                        tv5.setTextColor(Color.BLACK);
                        tr.addView(tv5);

                }
                }while(allrows1.moveToNext());

                table.addView(tr, new TableLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));

                i++;
                tr.setOnClickListener(new View.OnClickListener()
                {
                    public void onClick(View view)
                    {
                        view.setBackgroundColor(Color.LTGRAY);
                       // Toast.makeText(getApplicationContext(),""+tr.getId(),Toast.LENGTH_LONG).show();
                        tr1=(TableRow)view; //assign selected TableRow gobally
                        registerForContextMenu(tr1);
                        openContextMenu(tr1);
                    }
                });

            }while(allrows.moveToNext());

           }

    }
    catch(Exception e)
    {
          Toast.makeText(getApplicationContext(), "Error in search", Toast.LENGTH_LONG).show();
    }
}
  • 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-06T19:17:07+00:00Added an answer on June 6, 2026 at 7:17 pm

    The TableRow layout parameters must be wrap content. Instead of trying to expand the row in order to fit your needs, try to manually set the appropriate layout parameters in the views that are inside the TableRow object. Wrap content or fill parent won’t work, try playing around with actual density pixels.

    Hope this helps

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

Sidebar

Related Questions

I have created a table which is populated by JSON data so each row
I have created a table in postgreSQL. I want to look at the SQL
I have a jquery scorlling table which is populated dynamically. I am using Bob
I have a ListView which I've created a custom view for each row. My
I have created a TableRow layout model which I'm using as a template for
New to android programming. I have a layout XML, to which I want to
I have created one table using the below command: create table Table1( Id int
We have created a table with a trigger that updates a ModifiedDate field in
I have Created a table like CREATE TABLE [dbo].[tab1]( [Id] [int] NOT NULL, [Name]
I have created a table on an Oracle 10g database with this structure :

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.