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
도와 드리겠습니다. 안드로이드의 레이아웃 규칙은 분명히 이상하게 보입니다. TextView에 대한 소스를 살펴보고 minEms가 무시 될 수있는 이유를 찾아야했습니다 ... 부모가 fill_parent의 경우와 같이 커야하는 크기를 제어하는 경우 TextView는 minEms를 무시합니다. 부모를 wrap_content로 설정하면 자식이 자신의 크기 (minEms가 그림을 입력 할 수있는 위치)를 선택할 수 있습니다. 휴! –
필수 지연이 만료되는대로 현상금이 처리 중입니다. 다시 한 번 감사드립니다! – EboMike