Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
XML UI在android上未正确显示-按钮和文本输入未显示_Android_Xml_User Interface - Fatal编程技术网

XML UI在android上未正确显示-按钮和文本输入未显示

XML UI在android上未正确显示-按钮和文本输入未显示,android,xml,user-interface,Android,Xml,User Interface,我刚刚开始阅读android开发,所以我敢打赌有一个非常简单的解决方案 我遵循Android开发者网站上的指南,构建了示例UI。图形布局显示按钮和文本输入框没有问题,因此代码似乎没有问题。由于某些原因,它不会显示在AVT上或当我在手机上安装APK时。。。我正在使用Galaxy Nexus,并将AVT设置为Galaxy Nexus 我已经更新了ADT并尝试了几种方法,但我想可能是我忘记配置了什么?有人能帮忙吗 我是新来的,所以你要乖一点;) 以下是xml代码: <?xml version="

我刚刚开始阅读android开发,所以我敢打赌有一个非常简单的解决方案

我遵循Android开发者网站上的指南,构建了示例UI。图形布局显示按钮和文本输入框没有问题,因此代码似乎没有问题。由于某些原因,它不会显示在AVT上或当我在手机上安装APK时。。。我正在使用Galaxy Nexus,并将AVT设置为Galaxy Nexus

我已经更新了ADT并尝试了几种方法,但我想可能是我忘记配置了什么?有人能帮忙吗

我是新来的,所以你要乖一点;)

以下是xml代码:

<?xml version="1.0" encoding="utf-8"?>

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<EditText android:id="@+id/edit_message"
    android:layout_weight="1"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message" />
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send" 
    android:onClick="sendMessage" />

</LinearLayout>

提前感谢


<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">

<EditText android:id="@+id/edit_message"    
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:hint="@string/edit_message" />
<Button
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/button_send" 
    android:onClick="sendMessage" />

</LinearLayout>

另外,请检查您是否在活动中调用了setcontentview函数来传递此xml布局

是的,是setcontentview没有传递xml布局。谢谢你的帮助!