android用户界面错误
我正在学习本教程,在教程结束时,我有以下代码,但当我运行应用程序时,我没有按钮或文本字段,只有hello world 有什么问题 布局xmlandroid用户界面错误,android,Android,我正在学习本教程,在教程结束时,我有以下代码,但当我运行应用程序时,我没有按钮或文本字段,只有hello world 有什么问题 布局xml <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="horizontal"
tools:context=".MainActivity" >
<EditText android:id="@+id/edit_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/edit_message" />
<Button
android:aalyout_width="wrap_content"
android:layout_height="wrap_content"
android:text="text"="@string/buton_send"/>
字符串值
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">My First App</string>
<string name="action_settings">Settings</string>
<string name="edit_message">Enter a message</string>
<string name="button_send">Send</string>
我的第一个应用程序
设置
输入消息
发送
将
android:text=“text”=“@string/buton\u send”/>
更改为android:text=“@string/buton\u send”/>
我们的布局应如下所示
<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:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:orientation="horizontal"
tools:context=".MainActivity" >
<EditText android:id="@+id/edit_message"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="@string/edit_message" />
<Button android:id="@+id/button1" //here you missed the id....in your code
android:aalyout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/buton_send"/> //your code has incorrect syntax here
//这里的代码语法不正确
您是否收到任何错误?第一个布局应在res/layout/not AndroidManifest中。。。接下来,在Activity onCreate方法中,您应该使用setContentView(R.layout.xxxx)为您的活动设置布局(其中xxx是/res/layout/中的新布局xml文件)。第一块代码来自Activity_main.xml而不是manifestno,我没有收到任何错误,它只是以我的第一个应用和hello world作为内容显示模拟器。LinearLayout元素没有结束标记向最后一个按钮添加id:D