[英]How to make the same baseline for buttons with same size
As you can see the third button is below other, I want them to be in the same baseline 如您所见,第三个按钮位于另一个按钮的下方,我希望它们位于同一基线
My XML: 我的XML:
<LinearLayout
android:weightSum="3"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_weight="1"
android:textColor="@color/colorButtonText"
android:backgroundTint="@color/colorDayButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/send_btn"
android:text="@string/send"/>
<Button
android:id="@+id/statistics_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="@color/colorDayButton"
android:text="@string/statistics"
android:textColor="@color/colorButtonText" />
<Button
android:id="@+id/startAgain_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="@color/colorDayButton"
android:text="@string/start_again"
android:textColor="@color/colorButtonText" />
So, what should I do? 所以我该怎么做? Help me out, please
请帮帮我
Please Add the property android:maxLines="1"
for your button. 请为您的按钮添加属性
android:maxLines="1"
。 It will wrap your text to a single line 它将您的文本换成一行
<Button
android:id="@+id/startAgain_btn"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:backgroundTint="@color/colorDayButton"
android:text="@string/start_again"
android:maxLines="1"
android:textColor="@color/colorButtonText" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.