Reputation: 2148
I have a layout for items in a RecyclerView
like this:
<?xml version="1.0" encoding="utf-8"?>
<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="2">
<ImageView
android:id="@+id/imageView"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_rowSpan="2" />
<TextView
android:id="@+id/textView"
android:layout_row="0"
android:layout_column="1"
android:layout_marginRight="8dp"
android:padding="8dp" />
<android.webkit.WebView
android:id="@+id/webView"
android:layout_height="200dp"
android:layout_row="1"
android:layout_column="1"
android:layout_marginRight="8dp" />
</GridLayout>
The problem is, the TextView
and WebView
extend outside the area I was expecting. Their right-hand-sides are cut off. The amount they're being cut off looks like it's the width of the first column.
What is causing this and how can I rectify?
Upvotes: 2
Views: 679
Reputation: 1644
Set the items in the second column to have a width of 0dp and android:layout_gravity to fill horizontal. This should prevent them from clipping.
Upvotes: 2