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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:16:10+00:00 2026-05-30T22:16:10+00:00

I have an Activity that has all the display elements added dynamically. Theres no

  • 0

I have an Activity that has all the display elements added dynamically. Theres no xml for the acvtivity at all.

The Activity consists of the following controls:

  1. RelativeLayout (Layout object that all the child views sit in)
  2. TextView (Title for the page, sits at top of the RelativeLayout)
  3. ScrollView (Scrollable area that holds all the data controls)
  4. LinearLayout (Layout object to hold the activity buttons)

I want to know how it is possible to define that the ScrollView sits below the Title TextView and above the LinearLayout button holder where the LinearLayout is set to the Activity Page bottom

I have tried using RelativeLayout.LayoutParams to set up rules but cannot seem to understand the way to do it. Any help or links to tutorials would be apreciated

I have included my Code to see if someone can help

    // declare the items for display
    RelativeLayout baseLayout = new RelativeLayout(this);   
    // add the customer name and number field.
    // NOTE: We will always require this widget regardless of dialog design fields
    tvCustomerNameNumber = new TextView(this);
    tvCustomerNameNumber.setTextSize(20);
    tvCustomerNameNumber.setText("Customer Name & Number");

    // build up the linear layout of controls
    LinearLayout ll = new LinearLayout(this);
    ll.setOrientation(LinearLayout.VERTICAL);       

    // Scroll view.
    // NOTE: We will always need this widget to enable us to scroll the page
    // if too many items are added for the display size
    ScrollView sv = new ScrollView(this);
    sv.addView(ll);

    // buttons
    LinearLayout buttons = new LinearLayout(this);
    buttons.setOrientation(LinearLayout.HORIZONTAL);

    // button edit
    Button edit = new Button(this);
    edit.setId(EDIT_BUTTON_ID);

    // button save
    Button save = new Button(this);
    save.setId(SAVE_BUTTON_ID);

    // button cancel
    Button cancel = new Button(this);
    cancel.setId(CANCEL_BUTTON_ID);

    // add each button to the button layout
    buttons.addView(edit);
    buttons.addView(save);
    buttons.addView(cancel);

    // Scroll view Layout parameters
    RelativeLayout.LayoutParams scrollParams = new RelativeLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
    scrollParams.addRule(RelativeLayout.BELOW, tvCustomerNameNumber.getId());
    scrollParams.addRule(RelativeLayout.ABOVE, buttons.getId());

    // buttons Layout parameters
    RelativeLayout.LayoutParams buttonParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    buttonParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
    buttonParams.addRule(RelativeLayout.BELOW, sv.getId());

    // add the customer name number field to the base layout
    baseLayout.addView(tvCustomerNameNumber);
    // add the scroll view to the base layout
    baseLayout.addView(sv); //, scrollParams);      
    // add the buttons to the base layout
    baseLayout.addView(buttons, buttonParams);

    // set the content view
    this.setContentView(baseLayout);
  • 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-30T22:16:12+00:00Added an answer on May 30, 2026 at 10:16 pm

    Deva has already answered your question, but it sounds to me like you could define an xml layout as you have described above, inflate it and populate it dynamically programmatically… perhaps the layout would initially contain an empty LinearLayout, and/or no text set for the TextView, maybe even set everything to android:visibility=”gone” and show it when you have added/updated all your views?

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

Sidebar

Related Questions

I have an activity that shows customer information. All the controls are drawn dynamically
I have an activity that has a TabHost containing a set of TabSpecs each
So, I have written an app that has a Main activity (A), and various
I have a activity that I want to rotate. I use the following in
I have an Activity that consists of a large scrollview (that contains EditText fields)
I have created an application for Android that has an activity that has a
I have an activity that contains several user editable items (an EditText field, RatingBar,
I have an activity that launches another activity with startActivityForResult method. I would like
This seems like a simple problem: I have a WF4 activity that guides the
i have created a workflow activity that do give the item creater of 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.