3
私はEditText
を含む比較的シンプルなレイアウトです。アクティビティ自体はダイアログテーマを使用します。ダイアログは小さくなってしまい、編集テキストは初期の文字列を表示するのに十分な大きさではありません。android:ダイアログテーマのアクティビティでminEmsが無視されます
私は小さなダイアログが一般的な問題であることを知っています(IIRC Dianneはダイアログボックスがデフォルトで親ウィンドウにwrap_contentを使用すると述べています)。典型的な回避策はダイアログを特定のサイズに強制的に変更することです。onCreate
私はレイアウトでこの問題を解決することを好む。
EditTextにはandroid:minEms
という30の妥当なサイズが与えられていましたが、それは無視されるようですが、EditText(とダイアログ)はまだ小さいです。
サイドノート - ダイアログの高さも小さすぎます。下部のボタンは、半分のサイズにしてください。参照用
レイアウト、:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView android:id="@+id/TextView01"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/title"
android:gravity="center"
/>
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
>
<ImageButton
android:id="@+id/file_manager"
android:src="@drawable/ic_launcher_folder_small"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:onClick="pickFile"
/>
<EditText android:id="@+id/file"
android:text="@string/default_file"
android:inputType="text"
android:minEms="30"
android:layout_toLeftOf="@+id/file_manager"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
/>
</RelativeLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/action"
android:onClick="performAction"
android:text="@string/action">
</Button>
</LinearLayout>
あなたは天才です!私の間違いは、fill_parentが常にwrap_contentよりも長く/長くなることを前提としていました。 – EboMike
喜んで助けてください。 Androidのレイアウトルールは、確かに奇妙な場所で、これは明らかではありませんでした。私はTextViewのソースを見て、minEmsが無視される理由を調べなければなりませんでした.Find outは、親が(それはfill_parentの場合のように)大きくなければならない場合、minEmsを無視します。親をwrap_contentに設定すると、子は独自のサイズ(minEmsが画像に入ることができる場所)を選択できます。ピー! –
必須の遅延が経過するとすぐに賞金が払い戻されます。再度、感謝します! – EboMike