一、功能简介:
Button是程序用于和用户进行交互的一个重要控件,相信你对这个控件已经是非常熟悉 了,因为我们在上一章用了太多次 Button
二、创建textView文件:
以下是在layout.xml布局文件中的创建testView空间的一段代码:
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<Button
android:id="@+id/button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="Button" />
</LinearLayout>
1. 属性说明:
1.2 android:layout_width=”match_parent” 指定宽度
1.3 android:layout_height=”wrap_content” 指定高度
1.4 android:text=”Button” 指定内容
问题:
app效果只出现了textView控件,而Button按钮不可见
原因:
布局属性android:orientation 设置成 "vertical",垂直分布即可