Это мой макет и та часть, где у меня есть gridView, но в предварительном просмотре или в приложении нет элементов:
<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<variable
name="viewmodel"
type="com.kreeti.gogal.ui.profile.ProfileViewModel" />
</data>
<ScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.coordinatorlayout.widget.CoordinatorLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="15dp">
<TextView
style="@style/secondary_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/select_photos" />
<GridView
android:id="@+id/gridView"
android:layout_width="match_parent"
android:layout_height="250dp"
android:numColumns="3"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:stretchMode="spacingWidthUniform" />
</LinearLayout>
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</ScrollView>
</layout>
Это часть, где я устанавливаю адаптер,
gridView.adapter = ImageAdapter(this, R.layout.image_card, Array(6, {R.drawable.filled_rectangle} ))
Даже если я статически установлю некоторые элементы в макете, они не отображаются в gridView, я не могу понять, в чем проблема!