我在使用ListView中的RelativeLayout時遇到問題。我希望兩個EditText字段一個在另一個之上,而不是它們完全重疊。我有更多的文字放在每一行,所以並排不是一個選項。無法使RelativeLayout在列表視圖中工作
我試着取出所有多餘的代碼,使其工作,所以這是我有:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />
</LinearLayout>
這裏是我的相對佈局:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<EditText
android:id="@+id/time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20sp" />
<EditText
android:id="@+id/room"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/time"
android:textSize="20sp" />
</RelativeLayout>
任何幫助將不勝感激。謝謝。
您第二個edittext應該有android:layout_below =「@ + id/time」。 – KunalK