如何设置对话为主题的活动,以宽屏幕宽度? [英] How to set a dialog themed activity width to screen width?

查看:140
本文介绍了如何设置对话为主题的活动,以宽屏幕宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我跟随着描述的方法<一href="http://stackoverflow.com/questions/460418/best-way-to-show-a-edit-text-over-screen/460556#460556">here以创建一个EditText输入活性。但鉴于没有填满屏幕的宽度。我怎么能告诉以适应屏幕宽度?

 &LT;活动机器人:名称=TextEntryActivity
          机器人:标签=我的活动
          机器人:主题=@安卓风格/ Theme.Dialog/&GT;
 

-

 &LT; XML版本=1.0编码=UTF-8&GT?;
&LT;的LinearLayout
    的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
    机器人:layout_width =FILL_PARENT
    机器人:方向=垂直
    机器人:重力=右
    机器人:layout_height =WRAP_CONTENT&GT;
    &LT;的EditText
        机器人:文本=@ + ID / txtValue
        机器人:ID =@ + ID / txtValue
        机器人:layout_width =FILL_PARENT
        机器人:layout_height =WRAP_CONTENT&GT;&LT; /的EditText&GT;
    &LT;按钮
        机器人:文本=完成
        机器人:ID =@ + ID / btnDone
        机器人:layout_width =WRAP_CONTENT
        机器人:layout_height =WRAP_CONTENT&GT;&LT; /按钮&GT;
&LT; / LinearLayout中&GT;
 

解决方案

设置安卓了minWidth 和/或安卓了minHeight 在你的LinearLayout。

I am followin the method described here to create an EditText input activity. But the view doesn't fill the width of the screen. How can I tell to fit the screen width?

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

-

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:orientation="vertical"
    android:gravity="right"
    android:layout_height="wrap_content">
    <EditText
        android:text="@+id/txtValue"
        android:id="@+id/txtValue"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"></EditText>
    <Button
        android:text="Done"
        android:id="@+id/btnDone"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"></Button>
</LinearLayout>

解决方案

Set android:minWidth and/or android:minHeight in your LinearLayout.

这篇关于如何设置对话为主题的活动,以宽屏幕宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆