By far this is the best solution that I have come across with with regards to placing a Div element at the center both horizontally and vertically.

Add your custom width and height values to complete the result.

If you do not assign a width and height value, the Div will stretch its width to fill the screen but its height will be centered vertically depending on the content.

It may be common instinct for you to place a horizontal line in a TableLayout within the TableRow tags. However, when I did try that, the horizontal line never stretched to fill the whole width.

The trick is not to place the View tag inside the TableRow tag but outside of it. See example below.

Related Posts Plugin for WordPress, Blogger...