android – 如何将对话框主题活动宽度设置为屏幕宽度?

前端之家收集整理的这篇文章主要介绍了android – 如何将对话框主题活动宽度设置为屏幕宽度?前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
参见英文答案 > Android dialog width6个
我遵循 here描述的方法来创建EditText输入活动.但是视图没有填满屏幕的宽度.如何判断屏幕宽度?

alt text http://img405.imageshack.us/img405/5057/activitythemed.png

  1. <activity android:name="TextEntryActivity"
  2. android:label="My Activity"
  3. android:theme="@android:style/Theme.Dialog"/>

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <LinearLayout
  3. xmlns:android="http://schemas.android.com/apk/res/android"
  4. android:layout_width="fill_parent"
  5. android:orientation="vertical"
  6. android:gravity="right"
  7. android:layout_height="wrap_content">
  8. <EditText
  9. android:text="@+id/txtValue"
  10. android:id="@+id/txtValue"
  11. android:layout_width="fill_parent"
  12. android:layout_height="wrap_content"></EditText>
  13. <Button
  14. android:text="Done"
  15. android:id="@+id/btnDone"
  16. android:layout_width="wrap_content"
  17. android:layout_height="wrap_content"></Button>
  18. </LinearLayout>

解决方法

在LinearLayout中设置android:minWidth和/或android:minHeight.

猜你在找的Android相关文章