当前位置:
文档之家› ANDROID实验报告组件布局
ANDROID实验报告组件布局
<TextView
android:id="@+id/lpwd"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="密 码
"
android:layout_below="@id/lname"
2、使用线性布局完成系统主界面 <LinearLayout xmlns:android="/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" android:background="#FFFFCC"> <TextView
RelativeLayout
三、实验步骤
1、用表格布局完成登录界面 <TableLayout xmlns:android="/apk/res/android"
android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#FFFFCC" android:stretchColumns="0,3" > <ImageView android:layout_width="fill_parent"
android:layout_height="wrap_content" android:gravity="left" android:minWidth="200px" android:id="@+id/ETname"/> </TableRow> <TableRow > <TextView/> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" android:text="@string/password" android:textStyle="bold" android:textColor="#000000"/> <EditText android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="left" android:minWidth="200px" android:inputType="textPassword" android:id="@+id/ETpwd"/> </TableRow> <TableRow> <TextView /> <Button
Android 开发
(实验五)
实验题目:Android 组件布局试验 指导老师: 班 级:计算机科学与技术系班 姓 名:
一、实验目的
1、掌握 Android 组件布局的使用方法
2、学会组件布局的重要属性与应用
3、能够根据需求,通过布局构建各类实际的页面。
二、实验内容
组 件 布 局 有 : LinearLayout 、 TableLayout 、 FrameLayout 、
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="注册" android:layout_gravity="center" android:textSize="30sp" android:textColor="#000000"/> <RelativeLayout xmlns:android="/apk/res/android"
android:textSize="20sp"
android:textColor="#000000"/>
<EditText
android:id="@+id/ename"
android:layout_width="200px"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/lname"/>
android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:id="@+id/lname" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="用户名 " android:layout_gravity="center"
android:layout_height="5dp"/> <TableRow> <ImageView
android:layout_width="wrap_content" android:layout_height="100dp" android:src="@drawable/img" android:gravity="center" android:layout_span="4"/> </TableRow> <TableRow > <TextView/> <TextView
android:inputType="textPassword"
android:layout_toRightOf="@id/lpwd"
android:layout_alignTop="@id/lpwd"/>
<TextView
android:id="@+id/lapwd"
android:layout_width="wrap_content"
android:layout_alignTop="@id/lapwd"/>
<Button
android:id="@+id/Btok"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="提交"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="欢迎登陆此系统!" android:layout_gravity="center" android:textSize="30sp" android:textColor="#000000"/> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="退出" android:textSize="30sp" android:textColor="#000000" android:id="@+id/Btquit"/> </LinearLayout>
android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="right" android:text="@string/username" android:textStyle="bold" android:textColor="#000000"/> <EditText android:layout_width="fill_parent"
4、事件代码如下: LayoutTestActivity.java package youttest; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.EditText;