Dismiss your keyboard by tapping anywhere outside it.

Overview

Keyboard Dismisser

Android Arsenal Download

What is this?

Keyboard Dismisser is a simple library that allows you to dismiss keyboard by tapping anywhere outside it.

Currently supported root layouts of activities or fragments are : CoordinatorLayout, LinearLayout, RelativeLayout and ConstraintLayout.

Demo

How to download?

Add Keyboard Dismisser as a dependency in your app level build.gradle file.

dependencies {
    compile 'com.gabrielsamojlo.keyboarddismisser:keyboard-dismisser:1.3.1'
}

You can now use Keyboard Dismisser!

How to use?

Keyboard Dismisser works on whole Activity of your application or on specific Fragment. To use it with Activity, you just need to inform Keyboard Dismisser that you want to use it in your onCreate method :

    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        KeyboardDismisser.useWith(this);
    }

For fragments, you should place it in onViewCreated :

    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);

        KeyboardDismisser.useWith(this);
    }

Changelog

  • 1.2.0 (14/09/2017) - Added support for Constraint Layout (by Maciej Iwaniuk)
  • 1.2.2 (22/09/2017) - Resolved resizing layout when Constraint Layout is set to MATCH_PARENT
  • 1.2.3 (25/09/2017) - When unset, default size of layout is set to MATCH_PARENT now to avoid resizing of layouts
  • 1.3.0 (18/10/2017) - Added support for custom views
  • 1.3.1 (07/11/2017) - Resolved issue with dispatching event twice to some of dependent views

Support, contact and contribution

Feel free to contact me at [email protected] for any questions. Any forms of contribution are welcome, so feel free to fork and contribute with pull requests.

License

Copyright 2016 Gabriel Samojło

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.
You might also like...
Go Outside is an augmented reality app designed for our team's Software Engineering UI/UX class
Go Outside is an augmented reality app designed for our team's Software Engineering UI/UX class

Go Outside Go Outside is an augmented reality app designed for our team's Software Engineering UI/UX class. This app serves as a PROTOTYPE to demonstr

DocuBox is a cloud based file storing app where you can securely store and access your documents from anywhere around the world
DocuBox is a cloud based file storing app where you can securely store and access your documents from anywhere around the world

DocuBox is an android app 📱in which you can securely upload your files on the cloud– from family pictures and audio recordings to spreadsheets, presentations and other confidential documents.

🎨 Android colorpicker for getting colors from any images by tapping on the desired color.
🎨 Android colorpicker for getting colors from any images by tapping on the desired color.

ColorPickerView 🎨 ColorPickerView implements getting HSV colors, ARGB values, Hex color codes from any image drawables or your gallery pictures by ta

🎨 Android colorpicker for getting colors from any images by tapping on the desired color.
🎨 Android colorpicker for getting colors from any images by tapping on the desired color.

ColorPickerView 🎨 ColorPickerView implements getting HSV colors, ARGB values, Hex color codes from any image drawables or your gallery pictures by ta

Tapping-Game - Following the random instruction one has to tap the correct ball or balloon with correct text on it

Tapping-Game A simple game where a player has to follow the random instruction a

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Codename One - Cross Platform Native Apps with Java or Kotlin Codename One is a mobile first cross platform environment for Java and Kotlin developers

Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.
Cross-platform framework for building truly native mobile apps with Java or Kotlin. Write Once Run Anywhere support for iOS, Android, Desktop & Web.

Codename One - Cross Platform Native Apps with Java or Kotlin Codename One is a mobile first cross platform environment for Java and Kotlin developers

Kickstarter for Android. Bring new ideas to life, anywhere.

Welcome to Kickstarter's open source Android app! Come on in, take your shoes off, stay a while—explore how Kickstarter's native squad has built and c

Restler is a beautiful and powerful Android app for quickly testing REST API anywhere and anytime.
Restler is a beautiful and powerful Android app for quickly testing REST API anywhere and anytime.

Restler Restler has been built with simplicity and ease of use in mind. It allows you send custom HTTP/HTTPS requests and test your REST API anywhere

A DSL to handle soft keyboard visibility change event written in Kotlin.
A DSL to handle soft keyboard visibility change event written in Kotlin.

About A DSL to handle soft keyboard visibility change event written in Kotlin. How to use? Step 1. Add it in your root build.gradle at the end of repo

Digipad is a simple library for Android that only show a numeric keyboard onscreen
Digipad is a simple library for Android that only show a numeric keyboard onscreen

Digipad is a simple library for Android that only show a numeric keyboard onscreen Adding dependencies Add this to your build.gradle:

A 2020s compatible React Native keyboard avoiding view for Android and iOS that just works.

react-native-keyboard-shift Example Snack coming soon Until then: Clone this repo: git clone https://github.com/FullStackCraft/react-native-keyboard-s

Android Custom View for prevent the view behind on-screen keyboard when edit text is focused
Android Custom View for prevent the view behind on-screen keyboard when edit text is focused

Group Focusable Prevent the view behind on-screen keyboard when edit text is focused in Android UI Download Gradle implementation 'com.akexorcist:grou

Monitor keyboard height tools
Monitor keyboard height tools

Monitor keyboard height tools

Modern Kotlin version of com.example.semitop7.FireTVStyle keyboard

ftv-style-keyboard Modern Kotlin version of com.example.semitop7.FireTVStyle keyboard Manual activation on FireTV via adb shell: adb shell ime enable

Awesome keyboard animator that supports Android SDK 23 ✨
Awesome keyboard animator that supports Android SDK 23 ✨

KeyboardBeautify Awesome keyboard animator that supports Android SDK 23 ✨ This library was created based on the android/user-interface-samples. Previe

100% FOSS keyboard, based on AOSP.
100% FOSS keyboard, based on AOSP.

OpenBoard 100% FOSS keyboard, based on AOSP. Community [matrix] channel Join here Common issues Cannot open settings in MIUI: See issue #46. Contribut

FlorisBoard is a free and open-source keyboard for Android
FlorisBoard is a free and open-source keyboard for Android

FlorisBoard FlorisBoard is a free and open-source keyboard for Android 6.0+ devices. It aims at being modern, user-friendly and customizable while ful

Easily add slide to dismiss functionality to an Activity
Easily add slide to dismiss functionality to an Activity

Slidr Easily add slide-to-dismiss functionality to your Activity by calling Slidr.attach(this) in your onCreate(..) method. Usage An example usage: pu

Comments
  • Memory leak

    Memory leak

    Hi!

    @GabrielSamojlo Nice library, thank you so much!

    However, I think I found an issue regarding to memory leaks. In DismissingUtils, there is a method called setupKeyboardListener.

    In that method, addOnGlobalLayoutListener is called and it holds a reference to KeyboardListener which is implemented by a LinearLayout, and we also have a reference to contentView.

    I guess we should either call removeOnGlobalLayoutListener at some point, or just keep WeakReference to the aforementioned variables.

    What do you think?

    opened by szantogab 0
Owner
Gabriel Samojło
Gabriel Samojło
An Android library that allows you to easily create applications with slide-in menus. You may use it in your Android apps provided that you cite this project and include the license in your app. Thanks!

SlidingMenu (Play Store Demo) SlidingMenu is an Open Source Android library that allows developers to easily create applications with sliding menus li

Jeremy Feinstein 11.1k Dec 27, 2022
Android Library for making animated tutorials inside your app

##SlidingTutorial Cleveroad introduces Sliding Tutorial Library for Android Hey guys, hope you haven’t started developing a tutorial for your Android

Cleveroad 2.5k Dec 31, 2022
The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.

MaterialDrawer ... the flexible, easy to use, all in one drawer library for your Android project. What's included ?? • Setup ??️ • Migration Guide ??

Mike Penz 11.6k Dec 27, 2022
A flexible, easy to use, unique drawer library for your Android project.

Duo Navigation Drawer This Android library provides an easy way to create an alternative navigation drawer for android. Instead of a drawer that slide

PSD 1.1k Dec 21, 2022
Alligator is a modern Android navigation library that will help to organize your navigation code in clean and testable way.

Alligator Alligator is a modern Android navigation library that will help to organize your navigation code in clean and testable way. Features Any app

Artur Artikov 290 Dec 9, 2022
Navigation Component: THE BEST WAY to create navigation flows for your app

LIVE #017 - Navigation Component: A MELHOR FORMA de criar fluxos de navegação para o seu app! Código fonte do projeto criado na live #017, ensinando c

Kaique Ocanha 4 Jun 15, 2022
Xdimen - Support multiple screen sizes easily by scaling your dimensions

Support multiple screen sizes easily by scaling your dimensions. How does Xdimen work? When you have a UI design with a specific dimension, and

Islam Khaled 38 Dec 8, 2022
Animated Tab Bar is an awesome navigation extension that you can use to add cool, animated and fully customizable tab navigation in your apps

Animated Tab Bar is an awesome navigation extension that you can use to add cool, animated and fully customizable tab navigation in your apps. The extension provides handy methods and properties to change the behaviour as well as the appearance of the navigation bar.

Zain Ul Hassan 4 Nov 30, 2022
Simple Mobile Tools 172 Dec 26, 2022
Simple Keyboard can adjustable keyboard height for more screen space

Simple Keyboard About Features: Small size (<1MB) Adjustable keyboard height for more screen space Number row Swipe space to move pointer Delete swipe

Raimondas Rimkus 681 Dec 27, 2022