Android FrameLayout中图像视图之前的文本视图

Android FrameLayout中图像视图之前的文本视图,android,android-layout,Android,Android Layout,在我的布局中,我显示图像,在该图像上,我在底部显示文本视图。它工作得很好。我的代码是: <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:minHeight="210dp" android:padding="12dp"> <Im

在我的布局中,我显示图像,在该图像上,我在底部显示文本视图。它工作得很好。我的代码是:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minHeight="210dp"
android:padding="12dp">

<ImageView
    android:layout_width="match_parent"
    android:layout_height="210dp"
    android:id="@+id/imageViewNews"
    android:src="@mipmap/img_splash"/>

<com.mynews.widgets.TextViewRobotoBold
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom"
    android:id="@+id/textViewNewsTitle"
    android:background="#CCd3d3d3"
    android:padding="12dip"
    android:textColor="@color/color_primary_text_color" />
现在我想在这个图片之前显示一个文本视图,而不是在图片上,怎么做?我已经试过了,但它不是显示器。当我使用relativelayout时,将不显示任何内容。请建议我如何在上面的代码中在imageview之前显示textview

我还尝试使用relativelayout,如:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minHeight="210dp"
android:padding="12dp">

<com.mynews.widgets.TextViewRobotoBold
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|top"
    android:id="@+id/textViewTimeTitle"
    android:background="#CCd3d3d3"
    android:text="Last updated Time is:"
    android:padding="12dip"
    android:textColor="@color/color_primary_text_color" />

<ImageView
    android:layout_below="@+id/textViewTimeTitle"
    android:layout_width="match_parent"
    android:layout_height="210dp"
    android:id="@+id/imageViewNews"
    android:src="@mipmap/img_splash"/>

<com.mynews.widgets.TextViewRobotoBold
    android:layout_width="wrap_content"
    android:layout_below="@+id/imageViewNews"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom"
    android:id="@+id/textViewNewsTitle"
    android:background="#CCd3d3d3"
    android:padding="12dip"
    android:textColor="@color/color_primary_text_color" />
现在第一个文本视图显示在我想要的图像之前。但最后一秒文本视图显示在imageview下面,我希望它位于底部的imageview之上


如有任何建议,将不胜感激。提前感谢。

使用Raghunandan works建议的Relativelayout

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:minHeight="210dp"
android:padding="12dp">

<com.mynews.widgets.TextViewRobotoBold
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|top"
    android:id="@+id/textViewTimeTitle"
    android:background="#CCd3d3d3"
    android:text="Last updated Time is:"
    android:padding="12dip"
    android:textColor="@color/color_primary_text_color" />

<ImageView
    android:layout_below="@+id/textViewTimeTitle"
    android:layout_width="match_parent"
    android:layout_height="210dp"
    android:id="@+id/imageViewNews"
    android:src="@mipmap/img_splash"/>

<com.mynews.widgets.TextViewRobotoBold
    android:id="@+id/textViewNewsTitle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignBottom="@+id/imageViewNews"
    android:gravity="bottom"
    android:layout_gravity="center_horizontal|bottom"
    android:layout_centerInParent="true"
    android:background="#CCd3d3d3"
    android:padding="12dip"
    android:textColor="@color/color_primary_text_color" />

子视图绘制在堆栈中,最新添加的子视图位于顶部。。所以,如果您首先需要textview,那么就在xml中的imageview上方使用textview。也可以使用RelativeLayout。这取决于你想要什么。@Raghunandan我不想要文本视图而不是图像视图。我想在这个文本视图下面显示我的图像视图,在这个图像视图的底部显示一个文本视图。使用RelativeLayout是一个更好的选择。相对于放置文本视图imageview@Raghunandan请检查我编辑的问题。我试着用relativelayout。但现在第二个文本视图不显示在imageview上。它显示在imageview下面
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="240dp"

android:padding="12dp">

<com.mynews.widgets.TextViewRobotoBold
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|top"
    android:id="@+id/textViewTimeTitle"
    android:background="#CCd3d3d3"
    android:text="Last updated Time is:"
    android:padding="12dip"
    android:textColor="@color/color_primary_text_color" />

<ImageView
    android:layout_below="@+id/textViewTimeTitle"
    android:layout_width="match_parent"
    android:layout_height="match_parent"

    android:id="@+id/imageViewNews"
    android:src="@mipmap/img_splash"/>

<com.mynews.widgets.TextViewRobotoBold
    android:layout_width="wrap_content"
   android:layout_alignBottom="@+id/imageViewNews"
    android:layout_height="wrap_content"
    android:layout_gravity="center_horizontal|bottom"
    android:id="@+id/textViewNewsTitle"
    android:background="#CCd3d3d3"
    android:padding="12dip"
    android:textColor="@color/color_primary_text_color" />