我遇到了我的EditText
(身份證號)未填滿版面中可用空間的問題。我一直在尋找無處不在,並試驗大量資源,但我似乎無法得到它,並花了幾個小時就這麼做了。我猜想我的整個佈局設置有問題,並可能不能只是在EditText
作出調整。順便說一句,這個佈局被用在一個片段中,也許這改變了事情?我不確定,你們覺得呢?感謝您的幫助!這裏是我的代碼:Android - 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="match_parent"
android:layout_height="wrap_content"
android:layout_weight="1"/>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_weight="1" >
<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="0dp"
android:layout_weight="1"
android:gravity="top"
android:hint="write those saucy lyrics"
android:layout_marginTop="5dp"
android:scrollbars="vertical" />
<LinearLayout
android:id="@+id/linearLayout1"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<Button
android:id="@+id/confirm"
android:text="@string/confirm"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"/>
<Button
android:id="@+id/btnEmail"
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:layout_marginLeft="5dp"
android:text="@string/btnEmail"
android:alpha="1" />
</LinearLayout>
</LinearLayout>
</LinearLayout>
我在尋找我的設計看起來像這樣(從我的圖形佈局編輯器拍攝):
但是我的設備上,它看起來像這樣(從我的設備快照):
這個嘗試你的'EditText上的android:layout_height = 「FILL_PARENT」' –
試了一下現在...沒有工作:/ – webhoodlum