Android开发,App启动过渡页/欢迎页/开屏页

这种布局常用于App首次启动时的过渡页面,给用户一个品牌印象的同时,也提供了跳过等待的选项

1. 整体结构

使用RelativeLayout作为根布局,包含两个主要组件:

  1. 倒计时跳过按钮
<androidx.cardview.widget.CardView>
    <!-- 右上角的倒计时/跳过按钮 -->
    <TextView
        android:text="3s | 跳过"
        ... />
</androidx.cardview.widget.CardView>

特点:

  • 使用CardView实现圆角效果
  • 位于右上角(layout_alignParentRight=“true”)
  • 设置margin为20dp
  • 背景色使用my_light_primary
  • 圆角半径25dp
  • 无阴影(cardElevation=“0dp”)
  1. Logo展示
<androidx.cardview.widget.CardView>
    <!-- 中央Logo图片 -->
    <ImageView
        android:src="@mipmap/img_logo"
        ... />
</androidx.cardview.widget.CardView>

特点:

  • 使用CardView实现圆形效果
  • 位于屏幕中央(layout_centerInParent=“true”)
  • 固定尺寸110dp x 110dp
  • 圆形效果(cardCornerRadius=“55dp”)
  • 无阴影(cardElevation=“0dp”)

2. 布局特点

  1. 白色背景(android:background=“@color/white”)
  2. 使用CardView实现圆角/圆形效果
  3. 简洁的两个元素构成
  4. 采用RelativeLayout实现元素定位

3. 使用场景

这是一个典型的App启动页面布局,包含:

  • 品牌Logo展示
  • 倒计时跳过功能
  • 简洁大方的设计风格

4. 代码实现过程

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout 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:background="@color/white">


    <androidx.cardview.widget.CardView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentRight="true"
        android:layout_margin="20dp"
        android:backgroundTint="@color/my_light_primary"
        app:cardCornerRadius="25dp"
        app:cardElevation="0dp">

        <TextView
            android:id="@+id/tv_countdown"
            android:layout_width="88dp"
            android:layout_height="44dp"
            android:gravity="center"
            android:text="3s | 跳过"
            android:textColor="@color/white"
            android:textSize="16sp" />

    </androidx.cardview.widget.CardView>


    <androidx.cardview.widget.CardView
        android:layout_width="110dp"
        android:layout_height="110dp"
        android:layout_centerInParent="true"
        app:cardCornerRadius="55dp"
        app:cardElevation="0dp">

        <ImageView
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:src="@mipmap/img_logo" />


    </androidx.cardview.widget.CardView>


</RelativeLayout>

5. 效果图

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

浩宇软件开发

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值