androidandroid-layout

Android: Layout trying to insert 3 textviews across and 3 squares down


I am trying to create 3 textviews across and 3 textviews down (a total of 9 textboxes) evenly spaced and when the screen is changed i.e. Landscape and size of screen that they move to adjust the spaces between but the size of the textviews stay the same.

I have tried a linear layout and a relative layout, but could not get either to work. I think the right one is table.


Solution

  • Well if you gave up on RelativeLayout, try GridLayout ;)

    Or better, try Vertical LinearLayout filled with three Horizontal LinearLayouts.

    However you might want to use different layout folders to specify which one to use. So in landscape you will one layout and in portrait you use a different layout (both using the same name, located in layout-land and layout-port folders).

    Android layout folders: layout, layout-port, layout-land

    Android Organise Layouts into Sub Folders

    I guess it's the even-spacing that gets you, which is why you might want to try and do it by using a vertical layout filled with horizontal layouts.