Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
P

PatternLockView

> 设计协作
Open source

An easy-to-use, customizable and Material Design ready Pattern Lock view for Android

2.7K stars0 likes4 views
WebsiteGitHub

About

An easy-to-use, customizable and Material Design ready Pattern Lock view for Android

PatternLockView

An easy-to-use, customizable, Material Design ready Pattern Lock view for Android.

Specs

This library allows you to implement pattern locking mechanism in your app easily and quickly. It is very easy to use and there are plenty of customization options available to change the functionality and look-and-feel of this view to match your needs.

It also supports RxJava 2 view bindings, so if you are a fan of reactive programming (just like me), you can get a stream of updates as the user draws the pattern.

Download

This library is available in jCenter which is the default Maven repository used in Android Studio.

Gradle

gradle
dependencies {
    // other dependencies here
    
    compile 'com.andrognito.patternlockview:patternlockview:1.0.0'
    // Optional, for RxJava2 adapter
    compile 'com.andrognito.patternlockview:patternlockview-reactive:1.0.0'
}

Spread Some :heart:

Usage

We recommend you to check the sample project to get a complete understanding of the library. The step-by-step implementation guide is as follows.

Step 1

Place the view in your XML layout file.

xml
    <com.andrognito.patternlockview.PatternLockView
        android:id="@+id/pattern_lock_view"
        android:layout_width="280dp"
        android:layout_height="280dp"/>

This is enough to get the view rendered in your layout. But you would certainly want to add a callback listener to listen to pattern changes.

Step 2

Reference the view in code and add a listener to it.

java
mPatternLockView = (PatternLockView) findViewById(R.id.pattern_lock_view);
mPatternLockView.addPatternLockListener(mPatternLockViewListener);

Implement the listener interface as follows,

…

And that's it! Your PatternLockView is ready to rock. You might also want to remove the listeners when not needed, removePatternLockListener(mPatternLockViewListener);

Step 3 (Optional: ReactiveX Interface)

For the RxJava fanboys, this library supports RxJava 2 view bindings. You can subscribe to this view to get a stream of pattern change updates.

…

If you are not interested in getting the compound event, you should subscribe to patternComplete() and/or patternProgress() for the specific updates. Have a detailed look here.

Customization

There are several customization options available which you can use to completely change the look-and-feel and functionality of this view to match your needs.

XML (Quick and Easy)

You can add various attributes to the PatternLockView from your XML layout.

…

JAVA (Programatically)

You can also programatically change the properties of the view, thereby having more control over it.

…

Contribution

This library is inspired from AOSP's LockPatternView. There are lots of improvements and customization options added so that you can get started without any hassle. If you find a bug or would like to improve any aspect of it, feel free to contribute with pull requests.

About The Author

Aritra Roy

Android & Backend Developer. Blogger. Designer. Fitness Enthusiast.

License

Copyright 2017 aritraroy

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Javaandroidandroid-librarymaterial-designpattern-library

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category设计协作
PricingOpen source

> Related tools

F
Figma
协作式界面设计工具
S
sketch-wakatime
Sketch plugin for automatic time tracking and metrics generated from your Sketch usage.
Q
QuickColor
Quickly apply fills from the global or document color palettes to selected elements - 🎨