对话框主题活动中忽略android:minEms

对话框主题活动中忽略android:minEms,第1张

概述我有一个包含EditText的相对简单的布局.活动本身使用对话框主题.对话框最终很小,编辑文本甚至还不足以显示初始字符串.我知道小对话框是一个常见问题(IIRCDianne提到,默认情况下,该对话框使用父窗口的wrap_content),一种典型的解决方法是在onCreate中将对话框强制为一定大小.我更

我有一个包含EditText的相对简单的布局.活动本身使用对话框主题.对话框最终很小,编辑文本甚至还不足以显示初始字符串.

我知道小对话框是一个常见问题(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>

解决方法:

将您的relativeLayout更改为androID:layout_wIDth =“ wrap_content”.

总结

以上是内存溢出为你收集整理的对话框主题活动中忽略android:minEms全部内容,希望文章能够帮你解决对话框主题活动中忽略android:minEms所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1068430.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-26
下一篇 2022-05-26

发表评论

登录后才能评论

评论列表(0条)

保存