Git Product home page Git Product logo

codeeditview's Introduction

CodeEditView

通知

近期有用户反馈在Android9.0的手机上无法输入的问题,原因是因为项目中的targetSdkVersion版本设置过高,目前已知(targetSdkVersion 28)会出现该问题,目前已修复,新版本:

dependencies {
	implementation 'com.github.lvkaixuan:CodeEditView:v1.0.5'
}

效果图

动态图

Alt text

使用方法

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}
dependencies {
	implementation 'com.github.lvkaixuan:CodeEditView:v1.0.5'
}

布局中使用控件

<com.lkx.library.CodeEditView
  android:id="@+id/codeEditView"
  android:gravity="center_horizontal"
  android:layout_width="match_parent"
  android:layout_height="wrap_content"/>

代码中的回调监听

  codeEditView.setOnInputEndCallBack(new CodeEditView.inputEndListener() {
      @Override
      public void input(String text) { //输入完毕后的回调
           Toast.makeText(MainActivity.this, text, Toast.LENGTH_SHORT).show();
      }

      @Override
      public void afterTextChanged(String text) { //输入内容改变后的回调
          textView.setText(text);
      }
 });
 
   //清除输入框内容 (v1.0.2新增方法)
   codeEditView.clearText();
   //新增长按粘贴 (v1.0.3新增)

高级使用(自定义)

<com.lkx.library.CodeEditView
  android:id="@+id/codeEditView1"
  android:gravity="center_horizontal"
  android:layout_width="match_parent"
  app:textColor="@color/colorAccent"
  app:borderNum="4"
  app:borderMargin="20"
  app:borderSize="48"
  app:textSize="10"
  android:layout_height="wrap_content"/>
app:textColor=@color/colorAccent //字体颜色
app:borderNum=4 //输入框个数
app:borderMargin=20 //输入框间距
app:borderSize=48 //输入框大小
app:textSize=10 //字体大小"

Demo地址

codeeditview's People

Contributors

lvkaixuan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

codeeditview's Issues

有没有剪切板自动填充功能

App切换到后台,去复制验证码,再切回来的时候输入法上方会出现刚才复制的验证码,点击填充到对应的框框内

初始化view,显示view时弹出键盘也需要对EditText进行焦点处理,不然华为上会有问题,型号Nova 3

    //显示隐藏软键盘
    new android.os.Handler().postDelayed(new Runnable() {
        @Override
        public void run() {
            mEditText.setFocusable(true);
            mEditText.setFocusableInTouchMode(true);
            mEditText.requestFocus();
            InputMethodManager imm = (InputMethodManager) mContext.getSystemService(Context.INPUT_METHOD_SERVICE);
            imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
        }
    }, 500);

这个自动获取焦点的问题

怎么设置都不行,常用的给他父布局设置
android:focusable="true"
android:focusableInTouchMode="true"
就可以拦截焦点了,
这个就是拦截不了,

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.