目录
4.LinearLayout(线性布局)常用到的属性简单归纳一下
1.安装android的问题
- 不能出现安装目录中文和用户名中文(用户名中文使用模拟器时会报错,app直接下载手机上不会,我采用的是在自己手机上验证)
2.使用android 添加图标错误提示
- ' ' is not a valid file-based resource name character: File-based resource names must contain only lowercase a-z, 0-9, or underscore
- 查看一下布局命名是否有空格啥的,我的是因为布局命名有空格,然后大写字母也不行!
- Android 程序的设计讲究逻辑和视图分离,最好每一个活动都能对应一个布局。
3. RelativeLayout相对布局各个属性
- android:layout_above="@id/xxx" --将控件置于给定ID控件之上
- android:layout_below="@id/xxx" --将控件置于给定ID控件之下
- android:layout_toLeftOf="@id/xxx" --将控件的右边缘和给定ID控件的左边缘对齐
- android:layout_toRightOf="@id/xxx" --将控件的左边缘和给定ID控件的右边缘对齐
- android:layout_alignLeft="@id/xxx" --将控件的左边缘和给定ID控件的左边缘对齐
- android:layout_alignRight="@id/xxx" --将控件的右边缘和给定ID控件的右边缘对齐
- android:layout_alignTop="@id/xxx" --将控件的上边缘和给定ID控件的上边缘对齐
- android:layout_alignBottom="@id/xxx" --将控件的底边缘和给定ID控件的底边缘对齐
- android:layout_alignParentLeft="true" --将控件的左边缘和父控件的左边缘对齐
- android:layout_alignParentTop="true" --将控件的上边缘和父控件的上边缘对齐
- android:layout_alignParentRight="true" --将控件的右边缘和父控件的右边缘对齐
- android:layout_alignParentBottom="true" --将控件的底边缘和父控件的底边缘对齐
- android:layout_centerInParent="true" --将控件置于父控件的中心位置
- android:layout_centerHorizontal="true" --将控件置于水平方向的中心位置
- android:layout_centerVertical="true" --将控件置于垂直方向的中心位置
4.LinearLayout(线性布局)常用到的属性简单归纳一下
-
android:orientation="horizontal" 指定线性布局方向:水平
- android:orientation="vertical" 指定线性布局方向:垂直
- android:gravity="center" 指定线性布局中,子容器相对于父容器所在的位置为:正中心
- android:gravity="cente_verticalr" 指定线性布局中,子容器相对于父容器所在的位置为:垂直方向的正中心
- android:gravity="center_horizontal" 指定线性布局中,子容器相对于父容器所在的位置为:水平方向的正中心
- android:gravity="left" 指定线性布局中,子容器相对于父容器所在的位置为:最左边(默认)
- android:gravity="right" 指定线性布局中,子容器相对于父容器所在的位置为:最右边
- android:gravity="top" 指定线性布局中,子容器相对于父容器所在的位置为:最上方(默认)
- android:gravity="bottom" 指定线性布局中,子容器相对于父容器所在的位置为:最下方
5.TextView的相关属性以及他们的作用
- 设置显示文本:使用text属性
- 设置字体大小:使用textSize
- 设置字体颜色:使用textColor
- 设置背景颜色:使用background
- 设置文本位置,设置成“center”将文本居中显示:gravity
6.EditText 输入框相关属性
-
android:inputType="text" <!--文本格式-->
-
android:hint="默认提示文本" <!--和微信需要登录时一样,在文本框中提示的扣扣号,邮箱
-
android:textColorHint="#95A1AA" <!--提示的颜色-->