Android 高仿 扇贝 Splash 启动页 UI 篇

扇贝 启动页有个动画效果:

 

可以看出动画是慢慢的从原位置 按X,Y 比列放大。这里可以用视图动画去做,也可以用 属性动画做。

 

关于 Splsh启动页动画效果,之前 写过一篇:Android :为你的启动页面SplashActivity 添加动画的几种方法

1,视图动画

 关于视图动画:View Animation(视图动画)使用详解

res 目录下创建 anim 文件夹,xml 定义一个ScalAnimation scale.xml:

<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="2500"
    android:fromXScale="1.0"
    android:fromYScale="1.0"
    android:pivotX="50%"
    android:pivotY="50%"
    android:fillAfter = "true"
    android:toXScale="1.12"
    android:toYScale="1.12"/>

Splash 页面布局文件 activity_splash.xml:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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"
    android:orientation="vertical"
    >

   <LinearLayout
       android:layout_width="match_parent"
       android:layout_height="0dp"
       android:layout_weight="1"
       >
      <ImageView
          android:id="@+id/image"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:scaleType="centerCrop"
          android:src="@drawable/splash"
          />

   </LinearLayout>

   <TextView
       android:id="@+id/splash_tv"
       android:layout_width="match_parent"
       android:padding="5dp"
       android:text="这是高仿扇贝Splash"
       android:gravity="center_vertical"
       android:layout_height="100dp"
       />

</LinearLayout>

code:

 Animation animation = AnimationUtils.loadAnimation(this,R.anim.scale);
 imageView.startAnimation(animation);

效果图:

 

 

2,属性动画

  关于 属性动画:

  Property Animation(属性动画)使用详解

  Android属性动画完全解析(上),初识属性动画的基本用法

  set.playTogether(
                ObjectAnimator.ofFloat(imageView,"alpha",0.88f,1f),
                ObjectAnimator.ofFloat(imageView, "scaleX", 1f, 1.12f),
                ObjectAnimator.ofFloat(imageView, "scaleY", 1f, 1.12f)
        );
        set.setDuration(2500);
        set.start();

动画效果和上面一样。

关于启动白屏的问题

其实扇贝启动会有一瞬间的白屏,解决方案 Splash启动页主题添加:

  <item name="android:windowFullscreen">true</item>
   <item name="android:windowIsTranslucent">true</item>

 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Android Studio是一款专门用于开发Android应用程序的集成开发环境(IDE)。启动Android应用程序在启动时显示的第一个界面,通常用于展示应用程序的logo或者欢迎信息。下面是使用Android Studio开发App启动的步骤: 1. 创建一个新的Android项目:在Android Studio中点击"File" -> "New" -> "New Project",然后按照向导填写项目名称、包名等信息。 2. 在res目录下创建一个新的布局文件:在项目的res目录下找到"layout"文件夹,右键点击该文件夹,选择"New" -> "Layout resource file"。填写布局文件的名称,例如"activity_splash.xml",然后点击"OK"。 3. 在布局文件中设计启动的界面:使用Android Studio提供的可视化布局编辑器,在activity_splash.xml文件中设计启动的界面,可以添加图片、文字等元素。 4. 创建一个新的Activity类:在项目的java目录下找到你的包名,右键点击该包名,选择"New" -> "Java Class"。填写类名,例如"SplashActivity",然后点击"OK"。 5. 在SplashActivity中设置启动的逻辑:打开SplashActivity.java文件,在onCreate方法中设置启动的逻辑,例如延时一段时间后跳转到主界面。 6. 在AndroidManifest.xml中设置启动为应用程序的入口:打开AndroidManifest.xml文件,在<application>标签内添加以下代码: ``` <activity android:name=".SplashActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> ``` 以上是使用Android Studio开发App启动的基本步骤。你可以根据自己的需求进行界面设计和逻辑实现。如果有更具体的问题,请告诉我。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值