Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Managing Android layouts, there must be a better way

I'm trying to sort the layout for one of my Android apps, but I'm finding layouts a nightmare.

Principally I have to have a portrait and landscape layout for normal, small and large screens. So thats 6 layouts to maintain to start with, let alone having to launch the app on three emulators each time because my UI widets don't load in the built in previewer.

I might be showing my ignorance as a fairly new developer, but there must be a better way!

Are there any tools out there to help with Android layouts?

Thanks

like image 237
Tom Reay Avatar asked Oct 21 '10 19:10

Tom Reay


People also ask

What is the best layout for Android?

Use FrameLayout, RelativeLayout or a custom layout instead. Those layouts will adapt to different screen sizes, whereas AbsoluteLayout will not. Definitely right. I recommend RelativeLayout since it keeps the view hierachy flat.

What are layout managers in Android?

A LayoutManager is responsible for measuring and positioning item views within a RecyclerView as well as determining the policy for when to recycle item views that are no longer visible to the user.


1 Answers

You dont need to have that many layouts. Design only as many as you need, and never use absolute values, aditionally try to make everything look nice using fill_parent and wrap_content for you layout_width & layout_height tags. Android does most of the work it self. This article contains a lot of usefull info: Supportng multiple screens

like image 194
blindstuff Avatar answered Oct 20 '22 16:10

blindstuff