如何将文本视图放在图像上方和布局底部

时间:2016-04-11 11:54:33

标签: android xml android-layout android-studio

我已经尝试了从GravityalignParentToplayout_above的几乎所有内容,但似乎没有任何工作在这里。

我有ImageViewTextView我正在使用ViewPager来显示不同的图片及其各自的text

问题在于,它在顶部显示Text,在其后显示图像。

我希望它显示Image,并在其下方显示TextView

这是我在添加以下xml

后得到的内容
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">

    <ImageView
        android:id="@+id/image_view"
        android:layout_width="match_parent"
        android:layout_height="200dp"

        />
    <TextView
        android:id="@+id/image_text"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:text="Image Text"
        />

</RelativeLayout>

enter image description here

请指导我如何将Text放在Image

之后

0 个答案:

没有答案
相关问题