I would like to create buttons with round corners, an image and a text but I have issues in centering text and icon.
This is what I tried so far:
<FrameLayout android:layout_width="match_parent" android:layout_height="match_parent"
android:fitsSystemWindows="true">
<GridLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnCount="2"
android:rowCount="2"
android:layout_gravity="center"
**android:layout_marginLeft="15dp"**>
<ImageButton
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="10dp"
android:id="@+id/btnResult"
android:layout_gravity="center"
android:src="@drawable/result"
android:background="@layout/round_corners"
android:layout_row="0"
android:layout_column="0"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:text="@string/result"
android:id="@+id/tvAnalysis"
android:layout_gravity="center_horizontal"
android:layout_row="0"
android:layout_column="0"
**android:layout_marginTop="180dp"**/>
</...
I need to specify the android:layout_marginLeft of the GridLayout to have it centered on my Nexus 5. On all other devices this is not feasable.
Any idea what I need to change to center the imageview/text combination?