繁体   English   中英

在图库视图中的图像和下面的文本

[英]IN gallery view image and a text below

在我的应用程序中,我已经在galleryview中显示了图像。但是我想要的是一个图像和该图像下方的文本。考虑到我在gallery view中有大约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

请帮我。

<?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>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM