先自我介绍一下,小编浙江大学毕业,去过华为、字节跳动等大厂,目前阿里P7
深知大多数程序员,想要提升技能,往往是自己摸索成长,但自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!
因此收集整理了一份《2024年最新Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友。
既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,涵盖了95%以上Android开发知识点,真正体系化!
由于文件比较多,这里只是将部分目录截图出来,全套包含大厂面经、学习笔记、源码讲义、实战项目、大纲路线、讲解视频,并且后续会持续更新
如果你需要这些资料,可以添加V获取:vip204888 (备注Android)
正文
<RelativeLayout xmlns:android=“http://schemas.android.com/apk/res/android”
android:layout_width=“match_parent”
android:layout_height=“match_parent”
android:layout_marginBottom=“5dp”>
<ImageView
android:id=“@+id/iv_bean”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_alignParentTop=“false”
android:layout_alignParentEnd=“true”
android:layout_alignParentRight=“true”
android:layout_alignParentBottom=“true”
android:layout_marginEnd=“145dp”
android:layout_marginRight=“145dp”
android:layout_marginBottom=“320dp”
android:src=“@drawable/icon” />
<LinearLayout
android:layout_width=“match_parent”
android:layout_height=“wrap_content”
android:layout_alignParentBottom=“true”>
<Button
android:id=“@+id/btn_one”
android:layout_width=“0dp”
android:layout_height=“wrap_content”
android:layout_weight=“1”
android:text=“@string/btn_1”/>
<Button
android:id=“@+id/btn_two”
android:layout_width=“0dp”
android:layout_height=“wrap_content”
android:layout_weight=“1”
android:text=“@string/btn_2”/>
<Button
android:id=“@+id/btn_three”
android:layout_width=“0dp”
android:layout_height=“wrap_content”
android:layout_weight=“1”
android:text=“@string/btn_3”/>
<Button
android:id=“@+id/btn_four”
android:layout_width=“0dp”
android:layout_height=“wrap_content”
android:layout_weight=“1”
android:text=“@string/btn_4”/>
其中,按钮名称在(res/values/strings.xml)文件中说明,方便程序管理:
Animation
渐变
旋转
缩放
移动
在res目录下创建一个anim文件夹,并新建4个XML文件,分别命名为:
-
“alpha_animation.xml”(透明度渐变动画)
-
“rotate_animation.xml” (旋转动画)
-
“scale_animation.xml” (缩放动画)
-
“translate_animation.xml”(平移动画)。
分别将前面讲解的四个动画的XML代码放入创建的四个文件中。
在XML文件中定义好补间动画资源后,需要将动画资源设置到控件上。要实现该功能,需要在MainActivity中调用AnimationUtils类的loadAnimation()方法加载动画资源,并为图片(@drawable/icon)设置指定动画,具体代码如下:
文件MainActivity.java编写逻辑代码:
package com.example.animation;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private ImageView ivBean;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
//初始化组件并添加点击事件
Button buttonOne = findViewById(R.id.btn_one);
Button buttonTwo = findViewById(R.id.btn_two);
Button buttonThree = findViewById(R.id.btn_three);
Button buttonFour = findViewById(R.id.btn_four);
ivBean = findViewById(R.id.iv_bean);
buttonOne.setOnClickListener(this);
buttonTwo.setOnClickListener(this);
buttonThree.setOnClickListener(this);
buttonFour.setOnClickListener(this);
}
public void onClick(View v){
switch(v.getId()){
case R.id.btn_one:
//调用AnimationUtils的loadAnimation()方法加载动画
//单击按钮使用图片渐变
Animation alpha = AnimationUtils.loadAnimation(this,R.anim.alpha_animation);
ivBean.startAnimation(alpha);
break;
case R.id.btn_two:
//单击按钮使图片旋转
Animation rotate = AnimationUtils.loadAnimation(this,R.anim.rotate_animation);
ivBean.startAnimation(rotate);
break;
case R.id.btn_three:
//单击按钮使图像缩放
Animation scale = AnimationUtils.loadAnimation(this,R.anim.scale_animation);
ivBean.startAnimation(scale);
break;
case R.id.btn_four:
//单击按钮使图片移动
Animation translate = AnimationUtils.loadAnimation(this,R.anim.translate_animation);
ivBean.startAnimation(translate);
break;
}
}
}
可以看出,XML中定义的动画是通过AnimationUtils.loadAnimation()方法加载的,最后通过startAnimation()方法将动画设置到ImageView中。
video1.mp4
=================================================================
-
逐帧动画(Frame Animation)是按照事先准备好的静态图像顺序播放的,利用人眼的“视觉暂留”原理,给用户造成动画的错觉。逐帧动画的原理与放胶片看电影的原理是一样的,它们都是一张一张地播放事先准备好的静态图像。
-
在使用逐帧动画时,需要在res/drawable目录下创建好帧动画的XML文件,并在< animation-list >节点的< item >子节点中,指定图片帧出现的顺序以及每帧的持续时间。
===================================================================
布局文件activity_main.xml:
<?xml version="1.0" encoding="utf-8"?><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:background=“@android:color/white”
tools:context=“.MainActivity”>
<ImageView
android:id=“@+id/iv_flower”
android:layout_width=“wrap_content”
android:layout_height=“wrap_content”
android:layout_alignParentTop=“false”
android:layout_alignParentEnd=“true”
android:layout_alignParentRight=“true”
android:layout_alignParentBottom=“true”
android:layout_marginEnd=“145dp”
android:layout_marginRight=“145dp”
android:layout_marginBottom=“320dp”
android:background=“@drawable/frame” />
<Button
android:id=“@+id/btn_play”
android:layout_width=“70dp”
android:layout_height=“70dp”
android:layout_centerInParent=“true”
android:background=“@android:drawable/ic_media_play”/>
注意:ImageView的背景是Frame动画资源。
将需要制作为动画的图片统一存入drawable目录下,同时在drawable目录下创建Frame动画资源文件frame.xml,具体代码如下。
<?xml version="1.0" encoding="utf-8"?><item
android:drawable=“@drawable/rose_one”
android:duration=“200” />
<item
android:drawable=“@drawable/rose_two”
android:duration=“200” />
<item
android:drawable=“@drawable/rose_three”
android:duration=“200” />
<item
android:drawable=“@drawable/rose_four”
android:duration=“200” />
<item
android:drawable=“@drawable/rose_five”
android:duration=“200” />
<item
android:drawable=“@drawable/rose_six”
android:duration=“200” />
<item
android:drawable=“@drawable/rose_seven”
android:duration=“200” />
<item
android:drawable=“@drawable/rose_eight”
android:duration=“200” />
<item
android:drawable=“@drawable/rose_nine”
android:duration=“200” />
上述代码是定义Frame动画的基本语法格式,< animation-list >为帧动画的根节点,其中属性drawable表示当前帧要播放的图片,duration表示当前帧的播放时长,单位为ms,和前面补间动画中的属性介绍一致。
在MainActivity.java中编写逻辑代码播放Frame动画,具体代码如下:
package com.example.animation;
import android.graphics.drawable.AnimationDrawable;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
public class MainActivity extends AppCompatActivity implements View.OnClickListener {
private ImageView iv_flower;
private Button btn_start;
private AnimationDrawable animation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
iv_flower = findViewById(R.id.iv_flower);
btn_start = findViewById(R.id.btn_play);
btn_start.setOnClickListener(this);
//获取AnimationDrawable对象
animation = (AnimationDrawable)iv_flower.getBackground();
}
public void onClick(View v){
//判断动画是否在播放
if (!animation.isRunning()) {
写在最后
对程序员来说,很多技术的学习都是“防御性”的。也就是说,我们是在为未来学习。我们学习新技术的目的,或是为了在新项目中应用,或仅仅是为了将来的面试。但不管怎样,一定不能“止步不前”,不能荒废掉。
![
文章以下内容会给出阿里与美团的面试题(答案+解析)、面试题库、Java核心知识点梳理等
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
需要这份系统化的资料的朋友,可以添加V获取:vip204888 (备注Android)
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
链图片转存中…(img-hD5ZrAyX-1713444160637)]
[外链图片转存中…(img-NtpyukKY-1713444160637)]
[外链图片转存中…(img-r2tmQmKY-1713444160638)]
文章以下内容会给出阿里与美团的面试题(答案+解析)、面试题库、Java核心知识点梳理等
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
需要这份系统化的资料的朋友,可以添加V获取:vip204888 (备注Android)
[外链图片转存中…(img-56X15TeY-1713444160638)]
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!