大一下学期第一次刚接触到Android应用开发技术这个专业,第一次课就觉得好难,根本跟不上节奏
渐渐地在有点入门的之后发现其实也挺有意思的
<TextView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="欢迎来到学生空间" />
<EditText
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>(写这个的时候经常会少写最后一行)
第一次做出的是这个简单的界面
一:常用界面控件:利用这些写出相应的代码
TextView 显示文本信息①android:layout_width 设置控件的宽度
②android: layout_height设置控件的高度
③android:text 设置文本内容
④android:gravity 设置文本相对控件位置
⑤android:layout_gravity 设置控件相对于其所在容器
EditText 可编辑的文本框组件(输入)
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@android:color/transparent"
android:gravity="center"
android:text="登陆界面"
android:textSize="22sp"/>
<EditText
android:id="@+id/ev_userName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:digits="1234567890.+-*/%\n()"
android:hint="请输入用户名" />
<EditText
android:id="@+id/ev_password"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入密码"/>
ImageView 用于显示图片
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="头像"
android:textColor="@android:color/black"
android:textSize="20sp"/>
<ImageView
android:id="@+id/img_showmulti"
android:layout_width="79dp"
android:layout_height="wrap_content"
android:src="@drawable/tuzi"/>
RadioGroup 单选按钮组
RadioButton 单选按钮
<RadioGroup
android:id="@+id/rg_sex"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_male"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="@dimen/activity_vertical_margin"
android:checked="true"
android:text="男"
android:padding="20dp"
android:textSize="20sp"/>
Checkbox 复选框
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="我喜欢的课程 :"
android:textColor="@android:color/black"
android:textSize="20sp"/>
<CheckBox
android:id="@+id/chb_java"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Java"
android:textSize="20sp"/>
再对其实现功能
1.定义组件 private*****
2.加载 layout:****super.oncreat
建立相关的事件响应 获取组件对象*****.findViewById();
xml(就相当于一个文本 不需要编译)
文字大小一般使用sp
dp 文字以外大小?
orientation vertical 竖向线性布局;
horizontal横向线性布局;
wrap_content (不是很清楚该用在什么地方)
match_parent