我真的不喜歡問這些小問題,但在數小時後,它看起來像死衚衕。EditText在添加一個新行之前缺少字符
我在Android中遇到了編輯文本的問題。這是非常基本的,沒有風格適用於它。
問題是,如果我開始輸入它,當它達到最後的最大寬度,而不是添加一個換行符時,它會奇妙地「擴展」EditText寬度,並讓我插入大約10或12個字符,然後再實際添加一個新的線。顯然,所有這些10-12個字符都是「看不見」的。我真的不知道爲什麼會發生這種情況,任何幫助都會很受歡迎!
這是我的佈局:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center_horizontal"
android:background="@drawable/fondo_localizacion">
<TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_margin="5dp"
android:stretchColumns="1">
<TableRow >
<TextView
android:id="@+id/locationNameLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/LabelLocalizacion"
android:gravity="center_vertical"
android:text="@string/nombre_label">
</TextView>
<EditText
android:id="@+id/locationName"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
</EditText>
</TableRow>
<!-- La segunda fila tiene el par desc y su valor -->
<TableRow >
<TextView
android:id="@+id/locationDescLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/LabelLocalizacion"
android:gravity="center_vertical"
android:text="@string/desc_label">
</TextView>
<EditText
android:id="@+id/locationDesc"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
</EditText>
</TableRow>
<TableRow >
<TextView
android:id="@+id/locationPicLabel"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/LabelLocalizacion"
android:gravity="center_vertical"
android:text="@string/imagen_label">
</TextView>
</TableRow>
</TableLayout>
對於哪個EditText你有問題嗎? – Ian 2012-01-04 09:46:17
我曾爲它,無論是,@ loks解決方案工作得很好,謝謝你無論如何:) – AlejandroVK 2012-01-04 11:00:49