用imageview线性布局覆盖textview

Spu*_*pet 1 java eclipse android textview imageview

我有一些线性布局相互叠放,中间的一个有imageview。我正在尝试在中间的imageview顶部获取textview,但是遇到了麻烦。我尝试了相对布局,但是它弄乱了我所有其他布局。有什么简单的解决方案吗?编辑----

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#000000"
    android:orientation="horizontal"
    android:paddingLeft="50dp"
    android:paddingRight="50dp" >

    <ImageButton
        android:id="@+id/btnBck"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@null"
        android:src="@drawable/ic_launcher" />

    <ImageButton
        android:id="@+id/btnHome"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@null"
        android:src="@drawable/ic_launcher" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="6"
    android:orientation="vertical" >

    <ImageView
        android:id="@+id/picPreview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#000000"
        android:contentDescription="@string/imageDesc"
        android:src="@null" />

</LinearLayout>

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#000000"
    android:orientation="horizontal"
    android:paddingLeft="50dp"
    android:paddingRight="50dp" >

    <ImageButton
        android:id="@+id/btnAccept"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@null"
        android:src="@drawable/ic_launcher" />

    <ImageButton
        android:id="@+id/btnDecline"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:background="@null"
        android:src="@drawable/ic_launcher" />

</LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我正在尝试使文本视图位于id / picPreview图像视图之上

Jim*_*Jim 5

LinearLayout旨在将布局/视图连续(线性)放置。

一种解决方案是这样的:

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_weight="6"
    android:orientation="vertical" >
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <ImageView
        android:id="@+id/picPreview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#000000"
        android:contentDescription="@string/imageDesc"
        android:layout_centerInParent="true"
        android:src="@null" />
    <TextView
        android:id="@+id/picPreviewLbl"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_centerInParent="true"
        android:text="Overlay" />

</RelativeLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)