我想將當前佈局中的視圖元素與通過Android中的標記包含的視圖元素對齊。如何對齊Android中包含的佈局中的視圖元素
佈局1:(Layout1.xml)
<?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="wrap_content"
android:orientation="horizontal" >
<ImageView
android:id="@+id/click_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/desc"
android:padding="4dp"
android:src="@drawable/icon_click" />
<RelativeLayout
android:id="@+id/relativeLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/textView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:gravity="bottom"
android:paddingLeft="8dp"
android:paddingTop="6dp"
android:text="@string/textview1"
/>
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:text="@string/textView2"
/>
</RelativeLayout>
</LinearLayout>
佈局2:
<?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" >
<include
android:id="@+id/includedLayout"
layout="@layout/Layout1" />
<View
android:id="@+id/seperator"
android:layout_width="wrap_content"
android:layout_height="1dp"
android:alpha="0.3"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<!-- I want to align this layout with relative layout present in the
Layout1.xml file which is included above -->
</LinearLayout>
</LinearLayout>
我要對齊與RelativeLayout的所述Layout2.xml第二的LinearLayout在Layout1.xml文件,該文件是包含在Layout2.xml文件中。
如果有人知道解決方案,請讓我知道。
謝謝。
你要對齊文本觀點,即線性佈局?你能否更清楚 – akaya 2013-02-20 12:29:02
想要將Layout2.xml文件中的第二個LinearLayout與Layout1.xml文件中的RelativeLayout對齊[上面的代碼只是一個示例,此RelativeLayout可以包含除文本視圖以外的更多視圖]。 – Suman 2013-02-21 10:34:28