在我的应用程序中,我在galleryview中显示了图像..但我想要的是图像和该图像下方的文本。考虑我在图库视图中有10个图像,我想在每个图像下面描述该图像的文本(到我试过以下xml代码。但只有文字显示图像不会出现
我的xml文件:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/imageview1"
android:layout_width="120dp"
android:layout_height="100dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="-20dp"
/>
<TextView
android:id="@+id/text"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
android:layout_below="@+id/imageview1"
/>
</RelativeLayout>
我想要这样的设计:
galleryview1
image1 image2 image3
text1 text2 text3
galleryview2
image1 image2 image3
text1 text2 text3
请帮帮我。
答案 0 :(得分:0)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:orientation = "vertical"
android:layout_height="fill_parent"
>
<ImageView
android:id="@+id/imageview1"
android:layout_width="120dp"
android:layout_height="100dp"
/>
<TextView
android:id="@+id/text"
android:layout_width="50dp"
android:layout_height="wrap_content"
android:layout_marginTop="10dp"
/>
</LinearLayout>