4-1:【Android Studio安装】安装过程中出现的错误:参考https://blog.csdn.net/weixin_38277423/article/details/80254483

1.The SDK location is in inside studio install location

错误描述:The SDK location is in inside studio install location

解决方法:这个是由于SDK的安装目录是在Android Studio(简称:AS)的安装目录下,所以只需要在AS的安装目录外新建一个文件夹,并把SDK指定到这个目录下即可。

示例:AS 安装目录为-- D:\android-studio,只要SDK指定在这个目录外就可以了。

2.Android sdk location should not contain whitespace

解决方法:SDK的目录名称不能有空格。

3.

原因:

在第一次安装AS,启动后,检测到电脑没有SDK。

知道了原因,自然有解决方法,可以在以后安装sdk,或者设置初次打开AS,不下载sdk

解决方法:

第一种:

点击Cancel,在后续的界面再安装SDK。



第二种:设置初次打开AS,不下载sdk

1、在这个Android studio的安装目录下,找到下面这个文件: \bin\idea.properties

2、设置初次打开AS,不检测SDK。使用记事本打开,文件末尾添加一行:

  disable.android.first.run=true

网上大部分介绍这种方法,但是治标不治本,SDK没有下载,就算进入界面了,也用不了。还是要去下载SDK。

安装完成Android Studio

创建项目:

红色方框选中的Start a new Android Studio project选项通常是我们课程里最常使用的,用于创建一个新的Android项目。

在此介绍一下其他的选项:

Open an existing Android Studio Project:打开已有的Android Studio项目。在经历一段时间的学习后,如果你想继续编辑之前的项目,或者打开一个从网上下载的例子,你可以点击此选项。

Check out project from Version Control:从版本控制库中获取项目。对于团队开发来说,版本控制是必不可少的工具。此选项允许你从GitHub、Google Cloud以及TortoiseSVN等处同步项目。事实上,Android Studio对于这些版本控制工具的支持也是很好的,你可以在设置中进行设定。

Import project(Eclipse ADT, Gradle, etc.):导入其他开发环境中的项目。通过该选项你可以将在Eclipse等处生成的项目迁移到Android Studio的开发环境中。

Import an Android code sample:导入Android代码样例。该功能将从Google及其合作伙伴那里读取示例的列表,你可以下载并查看一些优秀的项目并继续编辑它们。



更改acitvity_main.xml 中的代码:



4-2:

实验要求:

参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十五章:
构建项目,运行教材相关代码
创建 ThirdActivity, 在ThirdActivity中显示自己的学号,修改代码让MainActivity启动ThirdActivity
提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分

步骤:





1.MainActivity:

package com.besti.is.zc.secondactivitydemo;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.content.Intent;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(this,ThirdActivity.class);
startActivity(intent);
}

}

2.左上角file->new->Activity->empty Activity创建ThirdActicity



3.activity_main.xml

<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="wyhy.activity.MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20175201zc"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

4.activity_third.xml

<android.support.constraint.ConstraintLayout 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">

<TextView
android:layout_width="144dp"
android:layout_height="26dp"
android:text="20175201zc"
tools:ignore="MissingConstraints"
tools:layout_editor_absoluteX="109dp"
tools:layout_editor_absoluteY="242dp" />

</android.support.constraint.ConstraintLayout>

运行截图:



4-3:UI测试

实验要求

参考《Java和Android开发学习指南(第二版)(EPUBIT,Java for Android 2nd)》第二十六章:
构建项目,运行教材相关代码
修改代码让Toast消息中显示自己的学号信息
提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分

步骤:

1.Main_Activity

package com.besti.is.zc.ui;

import android.content.Intent;

import android.support.v7.app.AppCompatActivity;

import android.os.Bundle;

import android.widget.Toast;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Toast.makeText(this,"20175201,Toast.LENGTH_LONG).show();
}

}

2.activity_main.xml

<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="wyhy.ui.MainActivity">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="20175201"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

</android.support.constraint.ConstraintLayout>

运行截图:



布局测试

实验要求

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

构建项目,运行教材相关代码
修改布局让P290页的界面与教材不同
提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分

步骤:

1.activity_main.xml

<RelativeLayout

xmlns:android="http://schemas.android.com/apk/res/android"

android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="2dp"
android:paddingRight="2dp"> <Button
android:id="@+id/cancelButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Home"
android:layout_marginRight="80dp"
android:layout_marginEnd="80dp"
android:layout_alignBaseline="@+id/saveButton"
android:layout_alignBottom="@+id/saveButton"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true" />
<Button
android:id="@+id/saveButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Back"
android:layout_marginBottom="100dp"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/cancelButton"
android:layout_toStartOf="@+id/cancelButton"
android:layout_marginRight="50dp"
android:layout_marginEnd="50dp" />
<ImageView
android:layout_width="100dp"
android:layout_height="150dp"
android:padding="10dp"
android:src="@android:drawable/ic_btn_speak_now"
android:id="@+id/imageView" android:layout_centerVertical="true"
android:layout_centerHorizontal="true" />
<LinearLayout
android:id="@+id/filter_button_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center|bottom"
android:background="@android:color/white"
android:orientation="horizontal"
android:layout_marginBottom="50dp"
android:layout_above="@+id/imageView2"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true">
<Button
android:id="@+id/filterButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Filter" />
<Button
android:id="@+id/shareButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Share" />
<Button
android:id="@+id/deleteButton"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="Delete" />
</LinearLayout>

运行截图:(这一项感觉直接改代码有些麻烦,直接图形操作界面)

4-5:

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

  • 构建项目,运行教材相关代码
  • 提交代码运行截图和码云Git链接,截图要有学号水印,否则会扣分

步骤

1.MainActivity

package com.besti.is.zc.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++]);

}

}

2.activity_main

运行截图:



点击换色:

我不会发动图,所以就发了几个颜色的图片

20175201张驰 实验四 Android 开发的更多相关文章

  1. #20175201张驰 实验三 敏捷开发与XP实践

    实验步骤 (一)敏捷开发与XP 一.敏捷开发与XP实践-1 ①实验要求: 敏捷开发与XP实践 http://www.cnblogs.com/rocedu/p/4795776.html, Eclipse ...

  2. 20145213 《Java程序设计》实验四 Android开发基础

    20145213 <Java程序设计>实验四 Android开发基础 说在前面的话 不同以往实验,对于这次实验具体内容我是比较茫然的.因为点我,打开实验四的链接居然能飘出一股熟悉的味道,这 ...

  3. 实验四 Android开发基础

    实验四 Android开发基础 实验内容 1.安装Android Studio 2.运行安卓AVD模拟器 3.使用安卓运行出虚拟手机并显示HelloWorld以及自己的学号 (一)SDK的安装 (二) ...

  4. 20145337实验四Android开发基础

    20145337实验四Android开发基础 实验内容 基于Android Studio开发简单的Android应用并部署测试; 了解Android组件.布局管理器的使用: 掌握Android中事件处 ...

  5. 20145225《Java程序设计》 实验四 Android开发基础

    20145225<Java程序设计> 实验四 Android开发基础 实验报告 实验内容 安装Android Studio 运行安卓AVD模拟器 使用安卓运行出虚拟手机并显示HelloWo ...

  6. 20145208 实验四 Android开发基础

    20145208 实验四 Android开发基础 安装Android Studio 安装的具体步骤在老师的链接中已经很详细了,在此就不做赘述了. 在此提出我觉得安装的时候需要注意的两个地方 一是安装地 ...

  7. 20145215实验四 Android开发基础

    20145215实验四 Android开发基础 实验内容 基于Android Studio开发简单的Android应用并部署测试; 了解Android组件.布局管理器的使用: 掌握Android中事件 ...

  8. 20165223 实验四 Android开发基础

    实验四 Android开发基础 目录 一.实验报告封面 二.具体实验内容 (一)Android Stuidio的安装测试 (二)Activity测试 (三)UI测试 (四)布局测试 (五)教材代码测试 ...

  9. 20155324 《Java程序设计》实验四 Android开发基础

    20155324 <Java程序设计>实验四 Android开发基础 实验内容 1.基于Android Studio开发简单的Android应用并部署测试; 2.了解Android.组件. ...

随机推荐

  1. 剑指offer-数值的整数次方-调整数组顺序使奇数位于偶数前面-代码的完整性-python

    题目描述 给定一个double类型的浮点数base和int类型的整数exponent.求base的exponent次方.   保证base和exponent不同时为0   思路 求base的expon ...

  2. luogu P5328 [ZJOI2019]浙江省选

    传送门 每个人都可以看成一条直线\(y=ax+b\),所以我们要求的是每条线在整点处,上方线的数量的最小值(注意多条直线如果交于同一整点互不影响) 如果\(m=1\),其实只要求出半平面交,然后在半平 ...

  3. MySQL数据库入门多实例配置

    MySQL数据库入门——多实例配置 前面介绍了相关的基础命令操作,所有的操作都是基于单实例的,mysql多实例在实际生产环境也是非常实用的,因为必须要掌握 1.什么是多实例 多实例就是一台服务器上开启 ...

  4. ES各种操作的过程

    参考:https://blog.csdn.net/better_xf/article/details/81188050 一.es写入数据的过程 客户端选择一个node发送请求过去,这个node就是co ...

  5. kali 下安装 vmtools

    网上的教程都是默认路径下的,kali是定制版本的,路径不同,所以首先要找到media下安装包的路径,然后进入该路下,将安装包复制到想要的路径下,并解压缩到想要的路径下,剩下的就跟网上的差不多了,即找到 ...

  6. Linux--目录管理与文件管理--02

    ******Linux目录结构与目录管理******* 一.Linux目录结构: 1.目录创建规则:FHS文件系统层次化标准 指定了Linux操作系统的哪些目录是一定要具备的 2.目录的结构 树形结构 ...

  7. 【c#】ADO操作Access的mdb数据库只能读不能修改的解决方法

    在使用ACCESS数据库时连接字符串如 string strcon=@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=F:\Access操作\简易 ...

  8. squid代理简介

    squid代理 简单介绍一下正向代理和反向代理 标准代理:缓存静态页面,但是要实现这种方式必须在内部主机的浏览器内指明代理服务址和端口. 透明代理:不需要指明代理服务器的IP和端口 二)反向代理 可以 ...

  9. Codeforces 989 P循环节01构造 ABCD连通块构造 思维对云遮月参考系坐标轴转换

    A 直接判存不存在连续的三个包含A,B,C就行 /*Huyyt*/ #include<bits/stdc++.h> #define mem(a,b) memset(a,b,sizeof(a ...

  10. 清北学堂提高组突破营游记day5

    长者zhx来啦.. (又要送冰红茶了...) zhx一上来就讲动态规划...是不是要逼死人.... 动态规划: 最简单的例子:斐波那契数列.因为他是递推(通项公式不算)的,所以前面的已经确定的项不会影 ...