• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Creating and positioning a view through java code

Prothean

Lurker
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.
 
Back
Top Bottom