I have a GridLayout sitting inside a RelativeLayout.
I have a bunch of buttons within this GridLayout. (I just used html to add this code here. It as an xml file though)
This is the output currently:
I want the GirdLayout to be centralised, with a margin of 24dp on top. I'm able to get the top margin, but not able to center the Grid. Any help is appreciated.
Thanks
Pings
HTML:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<GridLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:rowCount="5"
[INDENT]android:layout_marginTop="24dp"[/INDENT]
android:layout_centerHorizontal="true"
android:columnCount="7">
This is the output currently:

I want the GirdLayout to be centralised, with a margin of 24dp on top. I'm able to get the top margin, but not able to center the Grid. Any help is appreciated.
Thanks
Pings
Last edited: