I have a simple GridLayout
:
<GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:columnCount="2"
android:rowCount="1" >
<TextView
android:layout_column="0"
android:layout_row="0"
android:text="Label"/>
<EditText
android:inputType="text"
android:layout_column="1"
android:layout_row="0"
android:text="asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf asdf"
android:layout_gravity="fill_horizontal"/>
</GridLayout>
However this causes the EditText
to extend off the screen, as can be seen below (image from the IDE but it does the same when running on a device).
It appears that the EditText
is actually the full width of the screen rather than the width of the GridLayout
cell, which is why it is going off-screen. What has gone wrong in the layout to cause this?