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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T03:34:40+00:00 2026-06-07T03:34:40+00:00

Tell me how to programmatically assign a position to a button in android using

  • 0

Tell me how to programmatically assign a position to a button in android using linear layout. By default it takes the xtreme left position of the screen. Also i want to do it using Linear layout please do not suggest me using Relative layout. Following is my code

buttons_and_edittext=new LinearLayout(HelloAugmentedWorldActivity.this);
buttons_and_edittext = (LinearLayout)findViewById(R.id.linearLayout1);
buttons_and_edittextParameters = new LinearLayout.LayoutParams(120, 150);

button3 = new Button(this);
button3.setText("log");

buttons_and_edittext.addView(button3,      
buttons_and_edittextParameters);

any help will be appreciated 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-07T03:34:42+00:00Added an answer on June 7, 2026 at 3:34 am

    Please refer below link for add buttons into relative layout at fix position.

    Android User Interface Design: Relative Layout

    And Use Below Code also for that.

    Button but1 = new Button(this);  
    RelativeLayout.LayoutParams params2 = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);  
    params2.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);  
    but1.setLayoutParams(params2);  
    but1.setText("Press Here!");  
    // give the button an id that we know  
    but1.setId(1001);
    layout1.addView(but1);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to programmatically tell android to open the keyboard when the
The question about says it all. I want to programmatically tell the default launcher/home
How can I programmatically tell if the terminal services service is running and is
I have a UINavigationController, and I was wondering how I can programmatically tell when
can anyone tell me how I programmatically retrieve the actual Locale and/or Language in
How can I tell Windows XP to switch to standby mode programmatically with C/C++
Is there a way to tell programmatically at run-time whether a Google App Engine
Can anyone tell me how this would look like in C#? <EventTrigger RoutedEvent=Button.Click SourceName=btnSplit>
How can I programmatically tell in C# if an unmanaged DLL file is x86
Possible Duplicate: How can you programmatically tell an HTML SELECT to drop down (for

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.