Skip to content

how to change color when its wrong #12

Open

Description

@ArbazMateen

how to change color like you did in second screenshot

Activity

  1. markusressel commented on Feb 18, 2018

    @markusressel

    Use these attributes in your xml layout:

    app:correctStateColor="@color/md_green_A400"
    app:normalStateColor="@color/white"
    app:wrongStateColor="@color/md_red_A700"
    

    f.ex.:

    <com.andrognito.patternlockview.PatternLockView
                android:id="@+id/patternLockView"
                android:layout_width="280dp"
                android:layout_height="280dp"
                app:correctStateColor="@color/md_green_A400"
                app:normalStateColor="@color/white"
                app:wrongStateColor="@color/md_red_A700" />
    

    then in your activity setup a listener for your PatternLockView
    and change it's ViewMode after you validated the pattern:

    // if the pattern was correct:
    patternLockView.setViewMode(PatternLockView.PatternViewMode.CORRECT)
    
    // if the pattern was wrong:
    patternLockView.setViewMode(PatternLockView.PatternViewMode.WRONG)
    

    to reset the color (and pattern) just call:

    patternLockView.clearPattern()
    
  2. EhsanMashhadi commented on Feb 21, 2018

    @EhsanMashhadi

    I did what you said but the color not change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions