我正在嘗試爲android應用程序設計一個佈局。 這是XML:在android xml佈局中的微調框
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="New Text"
android:id="@+id/nameFB"
android:layout_gravity="end" />
<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:orientation="horizontal"
android:gravity="end">
<Spinner
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/type_string" />
<EditText
android:layout_width="50dp"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/yearTextName"
android:background="@drawable/edit_text_style"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/year_string" />
<EditText
android:layout_width="75dp"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/creatorTextName"
android:background="@drawable/edit_text_style"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/creator_string" />
<EditText
android:layout_width="75dp"
android:layout_height="wrap_content"
android:inputType="textPersonName"
android:ems="10"
android:id="@+id/nameTextBox"
android:background="@drawable/edit_text_style"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:text="@string/name_string" />
</LinearLayout>
<ListView
android:id="@+id/lv_search_results"
android:layout_width="match_parent"
android:layout_height="match_parent">
</ListView>
</LinearLayout>
</LinearLayout>
,它看起來像這樣:
,但是當我添加一個ID值的微調:
<Spinner
android:id="@+id/a"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
由於某種原因,廢墟佈局:
有誰知道爲什麼會發生?我唯一改變的是一個id的值,而不是圖形。 我該如何解決它?或者我該如何重新排列xml,以便文本框和微調框可以用文本視圖(可能是兩行)顯示?我試圖逐個放置線性佈局,並將它們放在窗口小部件中,但每次看起來都像第二張圖。