How to set background image on grid layout in android studio? This should be a simple problem, I might not search hard enough.
What I want to achieve
I have a nested scrollable grid layout, and I want to programmatically fill in the cells while using a background image for the entrie grid layout.
Here is the xml code
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="50dp"
android:layout_marginRight="150dp"
android:scrollbars="vertical">
<HorizontalScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<GridLayout
android:id="@+id/mapLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:background="@drawable/map_background"> // BK image here
</GridLayout>
</HorizontalScrollView>
</ScrollView>
I ignore the code for the cells but I can add it if anyone needs it. And here are the results. Cells with background image
What is the problem
The background image is too large, and the last column and row of cells stretch to the end. Problem cells