如何设置对话为主题的活动,以宽屏幕宽度?为主题、宽度、如何设置、宽屏幕

2023-09-13 01:07:36 作者:鹰击长空踏轻云

我跟随着描述的方法here以创建一个EditText输入活性。但鉴于没有填满屏幕的宽度。我怎么能告诉以适应屏幕宽度?

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

-

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

解决方案

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

一款好用的思维导图软件mindmanager中文版

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.