实验一:

Android Stuidio的安装测试: 参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十四章:

  • 参考http://www.cnblogs.com/rocedu/p/6371315.html#SECANDROID,安装 Android Stuidio
  • 完成Hello World, 要求修改res目录中的内容,Hello World后要显示自己的学号,自己学号前后一名同学的学号,提交代码运行截图和码云Git链接,截图没有学号要扣分
  • 学习Android Stuidio调试应用程序
package yh.is.besti.edu.cn.helloworld;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
}
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"> <TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!20165212 20165213 20165214"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" /> </android.support.constraint.ConstraintLayout>

实验二

Activity测试: 参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十五章:

  • 构建项目,运行教材相关代码
  • 创建 ThirdActivity, 在ThirdActivity中显示自己的学号,修改代码让MainActivity启动ThirdActivity
  • 提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="yh.is.besti.edu.cn.layouttest"> <application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application> </manifest>

实验三

UI测试: 参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十六章:

  • 构建项目,运行教材相关代码
  • 修改代码让Toast消息中显示自己的学号信息
  • 提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnshow1 = (Button) findViewById(R.id.btn1); btnshow1.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Toast toast = Toast.makeText(MainActivity.this, "20165213", Toast.LENGTH_LONG); toast.show(); } }); }
}

实验四:

布局测试: 参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十七章:

  • 构建项目,运行教材相关代码
  • 修改布局让P290页的界面与教材不同
  • 提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"> <Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="100dp"
android:layout_marginTop="100dp"
android:text="20165211" /> <FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20165211"></FrameLayout> <Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Button" />
</FrameLayout>

实验五

事件处理测试: 参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十八章:

  • 构建项目,运行教材相关代码
  • 提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分
package cn.edu.besti.is.jhs.multicolorclock;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AnalogClock;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.AnalogClock;
public class MainActivity extends Activity {
int counter = 0;
int[] colors = { Color.BLACK, Color.BLUE, Color.CYAN,
Color.DKGRAY, Color.GRAY, Color.GREEN, Color.LTGRAY,
Color.MAGENTA, Color.RED, Color.WHITE, Color.YELLOW };
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it
// is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
public void changeColor(View view) {
if (counter == colors.length) {
counter = 0;
}
view.setBackgroundColor(colors[counter++]);
}
}
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="10dp"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="10dp"
tools:context=".MainActivity">
<AnalogClock
android:id="@+id/analogClock1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentTop="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="90dp"
android:onClick="changeColor"
/>
</RelativeLayout>

https://private-cdn-oss.mosoteach.cn/mssvc/attachment/2018/05/974ea9398e516e722535386bb6b6bcce.jpg?x-oss-process=style%2Fs100xauto&OSSAccessKeyId=95rMSbPQpR5gkRWs&Expires=2147483647&Signature=aXM9S8JqTPSpEb3UxQEN%2Bjshqwo%3D

码云链接:https://gitee.com/BESTI-IS-JAVA-2018/20165213zqh/tree/master/Projects

Java第四次实验的更多相关文章

  1. 南京邮电大学java第四次实验报告

    实 验 报 告 ( 2017 / 2018学年 第2学期) 课程名称 JAVA语言程序设计 实验名称 Java集成开发环境的安装与使用. Java变量.表达式与控制结构 实验时间 2018 年 6 月 ...

  2. java第四次实验报告

    课程:Java程序与设计     班级:1352 姓 名:池彬宁  小组成员: 20135212池彬宁 20135208贺邦 学号:20135212 成绩:             指导教师:娄嘉鹏  ...

  3. 20135208 JAVA第四次实验

    课程:Java程序与设计     班级:1352 姓名:贺邦 小组成员: 20135212池彬宁 20135208贺邦 学号:20135208 成绩:             指导教师:娄嘉鹏     ...

  4. 20165210 Java第四次实验报告

    20165210 实验四 Android程序设计 实验步骤 第24章:初识Android 任务一:完成Hello World, 要求修改res目录中的内容,Hello World后要显示自己的学号 学 ...

  5. 20145330《Java程序设计》第四次实验报告

    20145330<Java程序设计>第四次实验报告 实验四 Android环境搭建 实验内容 1.搭建Android环境 2.运行Android 3.修改代码,能输出学号 实验步骤 搭建A ...

  6. 20145320《Java程序设计》第四次实验报告

    20145320<Java程序设计>第四次实验报告 北京电子科技学院(BESTI)实验报告 课程:Java程序设计 班级:1453 指导教师:娄嘉鹏 实验日期:2016.04.26 15: ...

  7. 2017-2018-2 20165301 实验四《Java面向对象程序设计》实验报告

    2017-2018-2 20165301 实验四<Java面向对象程序设计>实验报告 一.Android Stuidio的安装测试 实验要求: 参考<Java和Android开发学习 ...

  8. 20155201 实验四《Java面向对象程序设计》实验报告

    20155201 实验四<Java面向对象程序设计>实验报告 一.实验内容 1.基于Android Studio开发简单的Android应用并部署测试; 2.了解Android.组件.布局 ...

  9. 《JAVA程序设计》 20155208 实验四 Android程序设计

    <JAVA程序设计> 20155208 实验四 Android程序设计 实验一: 实验要求: Android Stuidio的安装测试: 参考<Java和Android开发学习指南( ...

随机推荐

  1. flask-appbuilder +echarts 展示数据笔记

    pip install flask-appbuilder fabmanager create-app cd newapp fabmanager create-admin fabmanager run ...

  2. 【maven】之nexus常用的一些配置

    nexus私服主要是在项目和maven中央仓库中间做代理,一般在公司内网或者公司内部的一些私包,都需要这么个产品.下面主要是关于maven和nexus之间的一些配置 1.在pom中配置nexus私服 ...

  3. set-----》集合

    1.set 是无序  不重复的序列 2.创建 list = [] dic = {"k1":123} set = {"123","333"}  ...

  4. centos7如何使用yum命令

    参照https://www.cnblogs.com/zhongguiyao/p/9029922.html 参照https://blog.csdn.net/shuaigexiaobo/article/d ...

  5. python读取指定字节长度的文本

    软件版本 Python 2.7.13;   Win 10 场景描述 1.使用python读取指定长度的文本: 2.使用python读取某一范围内的文本. Python代码 test.txt文本内包含的 ...

  6. mysql 5.7 修改字符编码

    在my.ini文件中添加 [mysqld]character-set-server = utf8 [client]default-character-set = utf8

  7. linux 配置vue环境

    系统 [root@Gao conf.d]# uname -a 工具 1.Final Shell 2.工具截图 需要下载的部分 node.js    npm   cnpm   vue-cli 安装nod ...

  8. 【机器学习_5】Anaconda:初学Python、入门机器学习的首选

    Anaconda是一个用于科学计算的Python发行版,提供了包管理与环境管理的功能,可以很方便地解决多版本python并存.切换以及各种第三方包安装问题. 集成包功能: NumPy:提供了矩阵运算的 ...

  9. List转Json函数

    public string ObjectToJson<T>(string jsonName, IList<T> IL) { StringBuilder Json = new S ...

  10. Redis 主从集群搭建及哨兵模式配置

    最近搭建了redis集群及哨兵模式,为方便以后查看特此记录下来: 1.Redis安装 2.主从架构 2.1 Redis主从架构图 2.2Redis主从结构搭建 Redis集群不用安装多个Redis,只 ...