我有一個肖像xml佈局文件,其中包含放置在ImageView上的文本框。這是使用垂直線性佈局完成的。麻煩的是,我已經創建了一個風景xml佈局文件,但我不知道如何在此特定佈局文件中的ImageView上方插入文本框。出於某種原因,我遇到了麻煩。總結一下,我想複製我在肖像xml中的樣式(關於文本框和ImageView關係)。下面的圖片應該明確說明我的意思。有意圖的圖標是灰色的,但你會得到一般想法。Android線性佈局困難
我的風景XML:
<?xml version="1.0" encoding="utf-8"?>
<!-- This relative layout will center EVERYTHING within it. Do not touch this functionality. -->
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/relative_layout"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ProgressBar
android:id="@+id/progressBar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal" >
<com.edmodo.cropper.CropImageView
xmlns:custom="http://schemas.android.com/apk/res-auto"
android:id="@+id/CropImageView"
android:layout_width="0dip"
android:layout_height="fill_parent"
android:layout_weight="1"
android:gravity="center" >
</com.edmodo.cropper.CropImageView>
<LinearLayout
android:layout_width="0dp"
android:layout_height="fill_parent"
android:layout_weight=".12"
android:gravity="center" >
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
tools:ignore="UselessParent" >
<ImageView
android:id="@+id/button1of3"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:contentDescription="@string/button1_description"
android:src="@drawable/ic_action_rotate"
android:visibility="invisible"
tools:ignore="Suspicious0dp" />
<ImageView
android:id="@+id/button2of3"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:contentDescription="@string/button3_description"
android:padding="2dp"
android:src="@drawable/ic_action_camera" />
<ImageView
android:id="@+id/button3of3"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:contentDescription="@string/button4_description"
android:src="@drawable/ic_action_feed" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
</RelativeLayout>
爲什麼你走了兩個佈局?你可以保持縱向和橫向的單一佈局。 – Lokesh
@Lokesh我知道,但我有我的肖像xml(一旦我把手機變成橫向模式)的問題。所以這不是我害怕的選擇。感謝您的建議:) – user2734823