Mały EditText ma setError z dużą ilością linii
Mam mały EditText i chcę wyświetlić w nim błędy (używając editText.setError ()). W Android API 10 wiadomość jest wyświetlana w wielu wierszach i jest nieczytelna. W systemie Android 15 działa stosunkowo dobrze. Załączam zrzuty ekranu, aby zilustrować problem na końcu pytania.
Jak mogę wyświetlać komunikaty o błędach w odpowiednim trybie?
Napisałem mały przykład, aby odtworzyć problem:
Aktywność:
<code>public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ((EditText) findViewById(R.id.b)).setError("A error description and bla bla bla bla bla."); } </code>
Układ:
<code><?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <EditText android:id="@+id/a" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" /> <EditText android:id="@+id/b" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" /> <EditText android:id="@+id/c" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" /> <EditText android:id="@+id/d" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" /> <EditText android:id="@+id/e" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" /> <EditText android:id="@+id/f" android:layout_width="0dip" android:layout_height="wrap_content" android:layout_weight="1" /> </LinearLayout> </code>
Urządzenie z Androidem API 10:
Tablet z Androidem API 15:
Powiązane pytanie. Ale odpowiedź nie działa dla mnie.
AKTUALIZACJAWykonałem ten sam kod na dwóch równych symulatorach z wyjątkiem poziomu API. Wyniki można zobaczyć na ekranach. Interfejs API 15 nadal nie naprawia błędu całkowicie. Tekst jest czytelny, ale wyskakujące okienko nie jest we właściwej pozycji.