GithubHelp home page GithubHelp logo

morristech / customnumberkeyboard Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 5.79 MB

A custom keyboard of android that can input number or decimals, currency etc.

License: Apache License 2.0

Java 100.00%

customnumberkeyboard's Introduction

CustomNumberKeyboard

A custom keyboard of android that can input number or decimals, currency etc.

Please feel free to use this.

Features

  • Curreny input and format.
  • Number input.
  • Decimals input.
  • Phone number input.
  • Custom rules.

Demo

Use Input

How do I use it?

Setup

Gradle

dependencies {
  // jCenter
  compile 'com.carlos.widget:numberkeyboard:1.1.+'
}

Keyboard config

step1

	<com.carlos.number.keyboard.KeyBoardLayout
		android:id="@+id/keyboard_layout"
		android:layout_width="match_parent"
		android:layout_height="wrap_content"
		android:layout_alignParentBottom="true"
		android:overScrollMode="never"
		android:scrollbars="none"
		app:key_board_clear_text="Clear"
		app:key_board_del_res="@drawable/icon_numeric_keyboard_blue_delete"
		app:key_board_type="number_with_decimals"
		app:key_item_background="@drawable/keyboard_item_normal_clicked_bg"
		app:key_text_color="@color/primaryBlue"
		app:key_text_size="25dp"
		app:key_board_line_res="@drawable/keyboard_line"/>

there also have some other attrs that can config the keyboard style.

setp2

		// watch keyboard text input.
		mKeyBoardLayout.addKeyBoardCallback(mCurrencyTwoDecimalDigitsView);
		mKeyBoardLayout.addKeyBoardCallback(mCurrencyNoneDecimalDigitsView);
		mKeyBoardLayout.addKeyBoardCallback(mNumberDecimalEditText);
		mKeyBoardLayout.addKeyBoardCallback(mPhoneNumberEditText);
		mKeyBoardLayout.addKeyBoardCallback(mPhoneNumberLineEditText);
		// if need line
		mKeyBoardLayout.setDrawLine(false);
		// show the keyboard.
		mKeyBoardLayout.showKeyBoard();

by the way, we can set different type to dynamic show the keyboad.

NumberEdit input

      <com.carlos.number.keyboard.NumberDecimalEditText
          android:id="@+id/et_phone_number_line"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@null"
          android:gravity="left|center_vertical"
          android:hint="phone number keyboard has line"
          android:inputType="number"
          android:maxLines="1"
          android:textColor="#333333"
          android:textColorHint="#cccccc"
          android:textCursorDrawable="@null"
          android:textSize="20sp"
          app:decimal_digits="0"
          app:max_input_integers="11"/>

decimal_digits and max_input_integers are used to config the input limits.we also can set it by the code, it's dynamic we can change the limits anytime by using code.

License

   Copyright 2017, Carlos Luo.

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.

customnumberkeyboard's People

Contributors

carlosluo17 avatar luoheng158 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.