小さな EditText があり、(editText.setError() を使用して) エラーを表示したいと考えています。Android API 10 では、メッセージが多数の行に表示され、判読できません。Android 15 では比較的問題なく動作します。質問の最後に問題を説明するためのスクリーンショットを添付します。
エラーメッセージを適切なモードで表示するにはどうすればよいですか?
問題を再現するための小さな例を書きました。
アクティビティ:
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.");
}
レイアウト:
<?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>
Android API 10 を搭載したデバイス:
Android API 15 を搭載したタブレット:
関連する質問。しかし、答えは私にはうまくいきません。
アップデート
API レベルを除いて、2 つの equals シミュレーターで同じコードを実行しました。結果は画面で確認できます。API 15 ではまだエラーが完全に修正されていません。テキストは判読可能ですが、ポップアップが正しい位置にありません。