Я работаю над приложением Xamarin, но я считаю, что эта концепция также применима к Android.LinearLayout под GridView не обертывает содержимое
Я хотел бы показать свои обернутые LinearLayout элементы в GridView, как показано ниже. Но это не выглядит так, как я ожидал.
Есть ли что-нибудь, что мне не хватает здесь?
Код:
Main.axml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minWidth="25px"
android:minHeight="25px">
<GridView
android:minWidth="25px"
android:minHeight="25px"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/gridViewHomeItems"
android:horizontalSpacing="10px"
android:verticalSpacing="10px"
/>
HomeItem.axml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:minWidth="25px"
android:minHeight="25px"
android:padding="25px">
<ImageView
android:src="@android:drawable/ic_menu_gallery"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/homeItemImage" />
<TextView
android:text="Item Title"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/homeItemTitle" />
</LinearLayout>
Вы пробовали с моим ответом? –