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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T16:18:25+00:00 2026-06-05T16:18:25+00:00

I basically want something like: TextView Button Button . . . TextView TextView SeekBar

  • 0

I basically want something like:

  TextView
  Button
  Button
  .
  .
  .
  TextView   TextView
  SeekBar
  Button

I have to do this programmatically.
Now, I have everything working except for the fact that the TextViews above the SeekBar are not showing.

The relevant code that is doing this work is

//Setting the linear layout
    ll =  new LinearLayout(getApplicationContext());                //a linear layout encompasses all the other elements
    ll.setOrientation(LinearLayout.VERTICAL);   //orientation has to be vertical
    ll.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));     //the layout occupies the complete screen

    //Set the TextView for the Question
    tv1 = new TextView(getApplicationContext());
    tv1.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));    //sets the dimensions of the textView
    ll.addView(tv1);                            //add the TextView to the LinearLayout

    //Set the buttons (?)
    b = new Button [MAX_OPTIONS];               
    for(int i=0;i<MAX_OPTIONS;i++){
        b[i] = new Button(getApplicationContext());     //set the context for each button
        b[i].setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
        ll.addView(b[i]);
    }

    //Set the Table Layout
    tl = new TableLayout(getApplicationContext());
    tl.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    tl.setColumnStretchable(0, true);
    tl.setColumnStretchable(1, true);

    //Set the Table Row
    tr = new TableRow(getApplicationContext());
    tr.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    tr.setPadding(dipConvert(5), dipConvert(5), dipConvert(5), dipConvert(5));

    //Set the two TextViews
    tv2 = new TextView(getApplicationContext());
    tv2.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    tv2.setGravity(Gravity.LEFT);               //set the gravity of this TextView to left
    tv3 = new TextView(getApplicationContext());
    tv3.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
    tv3.setGravity(Gravity.RIGHT);
    tv3.setPadding(0, 0, dipConvert(15), 0);    //set the padding for this to be displayed(the number 15 was emperically determined)

    //Add the Textview to table row
    tr.addView(tv2);        tr.addView(tv3);

    //Add the TableRow to the Table Layout
    tl.addView(tr);

    //Add the TableLayout to the LinearLayout
    ll.addView(tl);

    //Set the Seekbar
    sb1 = new SeekBar(getApplicationContext());
    sb1.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    sb1.setMax(100);
    sb1.setMinimumWidth(250);
    ll.addView(sb1);

    //Set the Seekbar Button
    sb1_b = new Button(getApplicationContext());
    sb1_b.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));

    ll.addView(sb1_b);
            setContentView(ll);

I cannot figure out what is going on. The display I get is something like

   TextView
   Button
   Button
   .
   .
   .

   SeekBar
   Button

It would be great if someone could point me in the right direction.

Thanks!

  • 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-05T16:18:27+00:00Added an answer on June 5, 2026 at 4:18 pm

    You need to need TableRow.layout param in the child elements of the tableRow elements. This has been explained well here. Please refer it and correct it. It is a very simple hiccup, which can be easily ignored.

    Your textview should be

    tv2.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT));
    

    and similarly for tv3 as well.

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

Sidebar

Related Questions

Basically, I want to do something like this (in Python, or similar imperative languages):
I just want to ask if anybody has done something like this. Basically, it's
So, I basically want to do something like this: http://jsfiddle.net/bUV6S/1/ ... But I want
Basically I want something like this. What are the ready-made options for me? Is
Basically I want to do something like this: $(document).ready(function() { if ($(body).attr(class) === HomePage)
I'm a bit stuck on this. Basically I want to do something like the
If I have classes A and B, I basically want to do something like
what I want to do is to use something like name=validate[required] basically use it
Basically I want something like the old VB 6 DataRepeater, where every item in
Basically I want to take something like: textheretextheretexthere <table> <tr><td>heres some stuff</td><td>and some morestuff</td></tr>

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.