最后
由于题目很多整理答案的工作量太大,所以仅限于提供知识点,详细的很多问题和参考答案我都整理成了 PDF文件
网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。
一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!
我们给SplashActivity设置单独的样式,我们重点是加了背景和设置状态栏背景为白色状态栏文字为黑色(因为演示的SplashActivity背景为白色所以设置状态栏为白色比较好),并且用了没有ActionBar的样式
<style name="Theme.WhitePageDemoSplash" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_500</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/white</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- 这三行是重点 -->
<!-- 设置背景,解决白屏的关键 -->
<item name="android:windowBackground">@drawable/bg_splash</item>
<!-- 设置状态栏为白色的,状态栏文字为黑的 -->
<item name="android:statusBarColor" tools:targetApi="l">@color/white</item>
<item name="android:windowLightStatusBar" tools:targetApi="m">true</item>
</style>
AndroidManifest.xml中设置上
<application
android:allowBackup="true"
android:name=".MyApplication"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.WhitePageDemo">
<activity android:name=".SplashActivity" android:theme="@style/Theme.WhitePageDemoSplash">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity" android:launchMode="singleTask" android:screenOrientation="portrait"/>
</application>
3.给样式设置背景
接下来是编写背景的xml文件,我设置背景为白色,这也是与SplashActivity对应起来,然后加了一张全屏缩放的图片,图片的背景透明
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle">
<solid android:color="@color/white" />
</shape>
</item>
<item>
<bitmap
android:gravity="fill"
android:src="@drawable/splashlog" />
</item>
</layer-list>
4.调整欢迎页布局
欢迎页的布局我们也用这张图片,也是占满整个布局并缩放,并且加了一个显示”跳过“的TextView
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@color/white"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:src="@drawable/splashlog"
android:scaleType="fitXY"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<TextView
android:text="跳过"
android:textSize="18sp"
android:textColor="@color/black"
android:layout_gravity="right"
android:layout_marginTop="40dp"
android:layout_marginRight="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</FrameLayout>
接下来我们看效果
我们发现页面会向下移动一下,那是因为当SplashActivity的布局加载出来的时候,会有一块状态栏高度的下移,并且如果有虚拟键盘的话也会影响整个视觉效果的过渡,接下来我们只需要把SpalshActivity的布局调整为全屏即可
5.让欢迎页充满全屏
这里给大家介绍个工具库(https://github.com/Blankj/AndroidUtilCode),非常好用
//工具类
implementation 'com.blankj:utilcodex:1.30.6'
具体操作如下:
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
### 文末
对于很多初中级Android工程师而言,想要提升技能,往往是自己摸索成长,不成体系的学习效果低效漫长且无助。 整理的这些架构技术希望对Android开发的朋友们有所参考以及少走弯路,本文的重点是你有没有收获与成长,其余的都不重要,希望读者们能谨记这一点。
最后想要拿高薪实现技术提升薪水得到质的飞跃。最快捷的方式,就是有人可以带着你一起分析,这样学习起来最为高效,所以为了大家能够顺利进阶中高级、架构师,我特地为大家准备了一套高手学习的源码和框架视频等精品Android架构师教程,保证你学了以后保证薪资上升一个台阶。
当你有了学习线路,学习哪些内容,也知道以后的路怎么走了,理论看多了总要实践的。
**进阶学习视频**
![](https://img-blog.csdnimg.cn/img_convert/265333f021dc2358e0e7bee55d7c59bf.webp?x-oss-process=image/format,png)
**附上:我们之前因为秋招收集的二十套一二线互联网公司Android面试真题** (含BAT、小米、华为、美团、滴滴)和我自己整理Android复习笔记(包含Android基础知识点、Android扩展知识点、Android源码解析、设计模式汇总、Gradle知识点、常见算法题汇总。)
![](https://img-blog.csdnimg.cn/img_convert/7758012252586fe670b22d37522834e6.webp?x-oss-process=image/format,png)
**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**
**[需要这份系统化学习资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618156601)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
么很难做到真正的技术提升。**
**[需要这份系统化学习资料的朋友,可以戳这里获取](https://bbs.csdn.net/topics/618156601)**
**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**