1. Are you ready for the Galaxy S20? Here is everything we know so far!

Creating and positioning a view through java code

Discussion in 'Android Development' started by Prothean, Oct 4, 2014.

  1. Prothean

    Prothean Lurker
    Thread Starter

    So, I am sorry if this is a really basic solution, I just started android development about a week ago, and am teaching myself. I am trying to create a basic view box, just a small square with a background color right in the middle of my screen. I know how to do this through the xml, but in the context that I need it I need to do it through the java code. I just need some help with the steps of creating this view, and positioning it in the center of the screen. I was able to create it and get it on the screen, but no matter what I try, it just says in the top left corner of the screen.

    Thank you for your time.
     



    1. Download the Forums for Android™ app!


      Download

       
Loading...
Similar Threads - Creating positioning view
  1. RicardoM
    Replies:
    1
    Views:
    319
  2. My project
    Replies:
    9
    Views:
    549
  3. grizmixstir
    Replies:
    3
    Views:
    714
  4. kdmoore
    Replies:
    3
    Views:
    894
  5. cwg01
    Replies:
    3
    Views:
    2,493
  6. kumaranil13k
    Replies:
    4
    Views:
    894
  7. 5g Moto Android 11
    Replies:
    2
    Views:
    1,789
  8. Muhammad Faizan Ali Khan
    Replies:
    2
    Views:
    556
  9. App Update
    Replies:
    0
    Views:
    404
  10. Mehak Gul
    Replies:
    1
    Views:
    402

Share This Page

Loading...