I have a GridLayout containing several Buttons. The translated text for the buttons is often longer than the English original, and this makes the buttons wider. I'd prefer that the text wraps across multiple lines if necessary, making the buttons less wide, so the buttons can still fit in the row. By default the GridLayout just seems to draw parts of buttons, or whole buttons, offscreen.
Here is the layout XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/table_detail"
style="?android:attr/textAppearanceLarge"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<GridLayout
android:id="@+id/layoutAnswers"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="4"
android:orientation="horizontal" >
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button2" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button3" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button4" />
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Button"
android:id="@+id/button5" />
</GridLayout>
</LinearLayout>
I've tried using the lines property, which just makes the buttons taller without wrapping the text. And I've tried various gravity and layout:gravity values. I'd prefer not to manually specify the newlines in the translations.