AUNumberKeyboardView provides numeric keypads in three states.
Use the component
Use the component independently to show a view, for example, a mini program.
Bind the component with AUAmountEditText and use them together. The binding tool is AUNumberKeyBoardUtil, which is encapsulated in AUAmountEditText. For more information, see AUAmountInputBox documentation.
Bind the component with common EditText and use them together. The binding tool is AUNumberKeyBoardUtil, which needs to be called independently.
Dependency
See Quick start.
API description
AUAmountEditText
/**
* Set the keyboard style. The default value is STYLE_POINT.
* @param style STYLE_POINT, STYLE_X, and STYLE_NONE.
*/
public void setStyle(int style)
/**
* Set button listening.
* @param listener
*/
public void setActionClickListener(OnActionClickListener listener)
/**
* Show status listening.
* @param windowStateChangeListener
*/
public void setWindowStateChangeListener(WindowStateChangeListener windowStateChangeListener)
/**
* Show.
*/
public void show()
/**
* Hide.
*/
public void hide()
/**
* Return the show state.
* @return
*/
public boolean isShow()
AUNumberKeyBoardUtil
/**
* Pass in EditText and AUNumberKeyboardView.
* @param context
* @param editText
* @param keyboardView
*/
public AUNumberKeyBoardUtil(Context context, EditText editText, AUNumberKeyboardView keyboardView)
/**
* Set the scroll view.
* @param view
*/
public void setScrollView(ScrollView view)
/**
* Show the numeric keypad.
*/
public void showKeyboard()
/**
* Hide the numeric keypad.
*/
public void hideKeyboard()
Code sample
AUAmountEditText
AUNumberKeyboardView auNumberKeyboardView = new AUNumberKeyboardView(this, AUNumberKeyboardView.STYLE_POINT, new AUNumberKeyboardView.OnActionClickListener() {
@Override
public void onNumClick(View view, CharSequence num) {
}
@Override
public void onDeleteClick(View view) {
}
@Override
public void onConfirmClick(View view) {
}
@Override
public void onCloseClick(View view) {
}
});
AUNumberKeyBoardUtil
XML
<com.alipay.mobile.antui.basic.AULinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<com.alipay.mobile.antui.basic.AUScrollView
android:id="@+id/scroll"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.alipay.mobile.antui.basic.AULinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<EditText
android:id="@+id/editText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="10dp" />
</com.alipay.mobile.antui.basic.AULinearLayout>
</com.alipay.mobile.antui.basic.AUScrollView>
<com.alipay.mobile.antui.keyboard.AUNumberKeyboardView
android:id="@+id/keyboard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"/>
</com.alipay.mobile.antui.basic.AULinearLayout>
Java
keyBoardUtil = new AUNumberKeyBoardUtil(context, editText, keyboardView);
keyBoardUtil.setScrollView(scrollView);