java - 我的 .xml 文件布局在模拟中未正确显示

标签 java android android-layout android-emulator

在这种情况下,我的 xml 文件显示某种布局,而在运行时生成另一个布局。我非常困惑为什么运行时显示的布局与给定的布局完全不同。这是 xml 文件的代码

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >


        <EditText
            android:id="@+id/username"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:ems="10" >

            <requestFocus />
        </EditText>
    </LinearLayout>

    <Button
        android:id="@+id/signUp"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="Sign up!" />
</LinearLayout>

这会在标签和按钮上显示“在此处插入名称”。该按钮已正确绑定(bind)并且按下它确实会执行某些操作,但是我无法在运行时在文本字段中输入内容。

最佳答案

这个看起来不错。仔细检查您是否正在使用 Java 代码更改任何属性。

关于java - 我的 .xml 文件布局在模拟中未正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13410497/

相关文章:

java - 创建一个热点并将没有背景的图像(如地球图标)设置到我的面板

java 按键方法调用

Android 上的 JavaScript 随机停止工作

android - APIdemo调用搜索问题android

android - ItemTouchHelper.Callback 方法 onChildDraw 和 onChildDrawOver 之间有什么区别?

android - 我想从 AndroidPlot 保存一个 .png 图像

android - 是否有 Android Material Design 的默认高度集合?

java - 使用 Java API 向 XSLT 程序提供参数

java.lang.OutOfMemoryError : Failed to allocate a allocation until OOM 错误

安卓自定义: swipe toggle button with image