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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:25:56+00:00 2026-05-25T00:25:56+00:00

My View is not generated programmatically, but it is found with findbyid function. After

  • 0

My View is not generated programmatically, but it is found with findbyid function. After getting view I like to position it properly.

To do that I am using layout function to change position of view in onCreate with given parameters. Problem is that is not working properly and view stays in top left corner.

Function works fine while using it onTouch after activity is loaded. What I am doing wrong, is there another to set view based on these four parameters that layout uses.

Edit:

Params are loaded from DB.
this is what I use in onCreate:

setContentView(R.layout.baseview);

View view=(ImageView) findViewById(R.id.blah);      

int top=cursor.getInt(cursor.getColumnIndex(CallerViewDB.TOP));
int bottom=cursor.getInt(cursor.getColumnIndex(CallerViewDB.BOTTOM));
int left=cursor.getInt(cursor.getColumnIndex(CallerViewDB.LEFT));
int right=cursor.getInt(cursor.getColumnIndex(CallerViewDB.RIGHT));
view.layout(left, top, right, bottom);

Loaded values are right, checked it w sqllite browser. It seems that calling layout function in onCreate does not anything. Is there any alternative?

  • 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-25T00:25:56+00:00Added an answer on May 25, 2026 at 12:25 am

    Ok after some reasearch this is how it is done:

    RelativeLayout.LayoutParams parms=new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
    parms.leftMargin=left;
    parms.rightMargin=right;
    parms.topMargin=top;
    parms.bottomMargin=bottom;
    view.setLayoutParams(parms);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Not that I'm trying to prevent 'View Source' or anything silly like that, but
I'm not talking about tools that let one view a page in combinations of
I'd like to be able to retrieve programmatically the command strings that generate the
I use DefaultValue for a property so that it will be not generated in
I'm calling a view after an AJAX POST action. But I'm loading the view
i am developing a iphone application in a view-based project,(not navigation) however i would
My view-state to action-state transition does not appear to be happening. In the following
Python's access to environment variables does not accurately reflect the operating system's view of
I have an application with a view containing several subviews. The subviews did not
EDIT: It is not a listbox. My mistake. It is a list view. I

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.