Search code examples
javaandroidandroid-layoutandroid-screen

Designing xml layouts for different screen: Android


I am working on a small app, with 3 buttons on left corner(Vertically) and a edit box which covers rest of the screen.

I want to run this app to be able to work on all screen resolutions. So I have used Relative layout, linear layout and Android:weight for buttons, which equally share the size of the buttons and works fine.

My Question is am I doing it wrong?

Should we design different layouts for different screens or using same layout out but adding properties like weight and padding is fine??


Solution

  • So, you want a responsive layout for your android app.

    Pointing to your question :

    [+1] layout -> Relative / Linear (in addition to the relative layout)

    property (Buttons) -> Android:weight

    is the right thing you are doing for your app.

    Alternative:

    But if you want a more responsive design then you could follow responsive design techniques by using html5 & css3 media queries etc. . And, could opt for a fluid layout also. By doing this the advantages you will have are:

    • Won't have a native UI only for android but the same could be used for other platforms (iOS,blackberry etc.) if you require.

    • The design would be more seamless with the native browser and the widgets won't get obsolete ever in the newer versions of your android platform also and changes once done would be reflected over the other platforms too.

    More info: MUST READ IF YOU WANT CLEAR UNDERSTANDING OF HOW TO DESIGN FOR ANDROID

    http://developer.android.com/design/style/devices-displays.html http://developer.android.com/design/style/metrics-grids.html#48dp-rhythm