Reputation:
How would one go about making a TableLayout centered just above the center of the parent?
Currently I'm using android:layout_gravity="center"
which is putting the layout exactly in the center. I've tried playing around with padding, but I couldn't find a solution.
I would like to have it above the center by about 10 dp.
Thanks in advance!
Upvotes: 0
Views: 77
Reputation: 1575
Take an invisible view in center of parent, and make your tableview align above that view with required margin at bottom like below. You can apply negitive margin also.
<View
android:id="@+id/centerView"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:layout_centerInParent="true"
android:visibility="invisible" />
<TableLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/centerView"
android:layout_marginBottom="10dp"
android:background="#ff0000">
.....
</TableLayout>
Upvotes: 0
Reputation: 3223
Use layout_centerVertical="true"
instead of the gravity.
Then increase the size of your layout and use the paddingBottom
to push your layout a bit on the top.
Upvotes: 2