Search code examples
androidandroid-layoutscreen-resolutionscreen-sizeandroid-screen-support

Layout with 12 round/circle buttons for different resolutions/screensizes


I need a layout that distributes 12 round buttons (circles) evenly on the screen.

For the round shape Im using this:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval" >
<solid android:color="@android:color/darker_gray"/>
</shape>

and as Layouts I use LinearLayouts (width= 0, height=fill and weight=1 for every button).

The problem is I have to set width and heights for the buttons to get a circle instead of a football shape (oval).

Is there a way to set width=height while still fitting different screen sizes?


Solution

  • Give the layout_height & layout_width value in DP. And put your XML in all the folders like layout, layout-large,layout-xlarge.