Giter Site home page Giter Site logo

shadwoview's Introduction

这里面包括两个两个自定义View 和一个自定义ViewGrop 第一个自定义View

    <com.example.shadowlibrary.MaskTextView
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginStart="20dp"
        android:layout_marginTop="20dp"
        android:layout_marginEnd="20dp"
        app:shadowText="自定义View实现阴影" />

使用 BlurMaskFilter实现 可以较好的实现一个扩散阴影的效果,可以支持阴影使用渐变色,也可以是图片颜色的延伸

实现效果

实现效果

第二个自定义Views使用setShadowLayer实现

    <com.example.shadowlibrary.ShadowTextView
        android:layout_width="match_parent"
        android:layout_height="60dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginStart="20dp"
        android:layout_marginTop="20dp"
        android:layout_marginEnd="20dp"
        app:shadowText="自定义View实现阴影"
        app:shadowTextRadius="10dp" />

实现效果

实现效果

自定ViewGrop使用 第二个自定义Views使用setShadowLayer实现实现

 <com.example.shadowlibrary.MaskViewGroup
        android:layout_width="match_parent"
        android:layout_height="150dp"
        android:layout_gravity="center_horizontal"
        android:layout_marginStart="10dp"
        android:layout_marginTop="10dp"
        android:layout_marginEnd="10dp"
        android:layout_marginBottom="20dp"
        app:containerCornerRadius="27dp"
        app:containerDeltaLength="10dp"
        app:containerShadowColor="@color/colorE9E9E9"
        app:containerShadowRadius="6dp"
        app:deltaX="0dp"
        app:deltaY="-3dp"
        app:enable="true">

        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:background="@drawable/shape_27_white"
            android:gravity="center" />
    </com.example.shadowlibrary.MaskViewGroup>

实现效果

实现效果

博客地址:https://www.jianshu.com/p/9b5d111aa306

shadwoview's People

Contributors

525642022 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.