我写了一段代码,在GridView中显示图片,但现在我想在每张图片的底部显示文本。
我想要显示的GridView如下图所示:
但我得到的结果是这样的[也想为图片显示文本]:
main.xml:
我想要显示的GridView如下图所示:
![enter image description here](https://istack.dev59.com/rUhkr.webp)
![enter image description here](https://istack.dev59.com/iYR4n.webp)
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<GridView
android:id="@+id/gridview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:stretchMode="columnWidth"
android:numColumns="2"
/>
</FrameLayout>