Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Android

views in graphical layout are stuck in the center

when i try and move the views around they dont move and remain in the center.

1 Answer

Daniel Hartin
Daniel Hartin
18,106 Points

Are you using a linear or relative layout? A relative layout has more of a drag and drop feel but can be more difficult to alter in xml. Liner layouts are more structured I find but easier to manage in xml, it's usually a personal preference with each individual. Make sure your views don't have the property layout_gravity="center" otherwise they will always be centered.

I would highly recommend trying combinations using the xml code as you can see clearly what you want each view to behave like. I personally find the graphical layout and UI too cumbersome for most tasks and is only good for getting a general feel for your layout.

i transfered the xml from the fragment to the activity and it works now. idk why but thanks for the reply. edit: thanks, it was in gravity center