我遇到了我的碎片xml的佈局問題......我想這可能是因爲佈局最初只是爲了一個活動而創建的,然後它被更改了到一個片段。它看起來像這樣在我的編輯器:Android - Layout xml中EditText的大小問題
但在我的手機和模擬器,它最終是這樣的:
誰能想到了我一個解決方案嗎?我已經嘗試了多件事情,但似乎無法修復它,因爲我認爲在處理碎片時規則可能有點不同。感謝您的一切和任何幫助!
<?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">
<LinearLayout android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title" />
<EditText android:id="@+id/title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
<TextView android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/body" />
<EditText android:id="@+id/body" android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"
android:scrollbars="vertical" />
<Button android:id="@+id/confirm"
android:text="@string/confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
的活動佈局文件:
<?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" >
<FrameLayout
android:id="@+id/frame1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/textView1"
android:layout_marginTop="130dp"
android:layout_toRightOf="@+id/textView1" >
</FrameLayout>
</LinearLayout>
你可以發表你的活動佈局 – Libin