As you can see the third button is below other, I want them to be in the same baseline
My 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
答案 0 :(得分:0)
Please Add the property android:maxLines="1"
for your button. 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" />