Android程序水印效果

本文介绍了Android应用程序中添加水印的效果,包括水印的原理和具体实现步骤。水印通过在布局顶部或底部添加透明层,结合自定义TextView实现文字动态赋值和旋转,以此达到所需效果。
摘要由CSDN通过智能技术生成

概述

首先看一下大致的水印效果
水印效果
上图中的水印中的文字部分是根据不同的账号进行动态赋值的。那么,如何进行水印效果的添加呢?下面结合代码简要说明一下。


水印的原理

水印的原理是在整个布局的最上方或者最底部铺设一层要求的布局文件,而且这个布局文件是全透明的,并且不会添加上任何的点击事件。

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="#00000000"
    android:orientation="vertical">

    <GridLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="-100dp"
        android:layout_marginRight="-100dp"
        android:background="#00000000"
        android:columnCount="2"
        android:orientation="vertical"
        android:rotation="-45"
        android:rowCount="2">

        <cn.chinamobile.cmss.mcoa.contact.ui.view.WaterMarkText
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="top|left"
            android:layout_margin="5dp"
            android:text="@string/water_mark_show"
            android:textColor="#40a7adb8"
            android:textSize="14sp" />

        <cn.chinamobile.cmss.mcoa
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值