Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


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