由于在Android中,每个xml文件都必须只有一个根布局。 只需在LinearLayout中添加EditText和Button。正确的代码如下所示
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="match_parent"> <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" /></LinearLayout>
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)