Button Aligment Problem In Android

If the buttons are set as singleLine = “false”  in a LinearLayout and If they have multiline text, there may be alignment problem between the buttons.

As in the shown below;

android button align problem

 

The horizontal LinearLayout implements baseline alignment to the objects. In this situation, the second buttos is trying to align with the first one’s text line.

Here is the solution;

 

Disabling the base line alignment of the buttons’ container LinearLayout will fix the problem as in the shown below

 android:baselineAligned="false"

android button align fix

 

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.