安桌登录页面是个简单的页面并不包含实际功能
用到的知识
布局
1相对布局
<RelativeLayout
包括宽度 高度
2按钮
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableLeft="@drawable/ic_launcher"
android:text="登录" />
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:drawableLeft="@drawable/ic_launcher"
android:text="登录" />
命名格式 宽度高度 以及图片在左侧的方法
3编辑框
<EditText
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_alignParentLeft="true"
android:layout_marginBottom="21dp"
android:ems="10"
android:hint="输入登录密码:"
android:textColor="#000" >
android:id="@+id/editText1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/button1"
android:layout_alignParentLeft="true"
android:layout_marginBottom="21dp"
android:ems="10"
android:hint="输入登录密码:"
android:textColor="#000" >
编辑框的位置 hint提示功能
4各种标签的基本属性
id 格式@+id 命名规则一般为两个单词组合的首字母
width 宽度 可以设置宽度为wrap conent 及 match parent 以及自定义
height 高度 设置方式与宽度相差不大
textcolor 字体的颜色包括#000以及#fff
简单的登录页面并不复杂就用到了这些基础知识。
步骤首先打开编译器然后new一个安卓项目
设置应用名称
设置项目名称
包名 可选sdk版本以及主题
设置机器人的大小以及背景框与颜色选择主题这样一个安卓项目就创建完毕了
然后打开res->layout->activity_main
在这里面进行布局操作
在Graphical里面可以预览结果
本文介绍了一个简单的安卓登录页面设计过程,使用相对布局整合按钮与编辑框,并解释了基本控件的属性设置方法。

4万+

被折叠的 条评论
为什么被折叠?



