简体   繁体   中英

IN gallery view image and a text below

In my application I have shown image in galleryview..But what i want is an image and a text below that image.Consider i have some 10 images in gallery view ,i want a text below each image describing that image(to that image image length).I tried for the following xml code.But only text is showing image is not coming

My xml file:

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

I want design like this:

galleryview1
image1      image2    image3

text1       text2     text3

galleryview2

image1    image2     image3

text1     text2      text3

Please help me.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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