All Products
Search
Document Center

Amount input box

Last Updated: May 25, 2021

The AUAmountInputBox component provides an input box for the capital chain, and the number in the input box is in a special digit font. The input box includes two parts: edit box (AUAmountEditText) and notes (AUAmountFootView). AUAmountFootView has two styles, editable input box and text display, which can be used as needed.

In addition, the component provides AUAmountLabelText for special digit font display.

Sample images

Note: The following figure shows the amount input rules.

Dependency

See Quick start.

API description

AUAmountInputBox

 
  1. /**
  2. * Get the edit box.
  3. * @return
  4. */
  5. public AUEditText getEditText()
  6. /**
  7. * Get the edit box.
  8. * @return
  9. */
  10. public AUAmountEditText getEditLayout()
  11. /**
  12. * Get footView of the capital chain.
  13. * @return
  14. */
  15. public AUAmountFootView getFootView()
  16. /**
  17. * Get the title bar of the output box.
  18. * @return
  19. */
  20. public AUTextView getTitleView()
  21. /**
  22. * Set properties of HeadView.
  23. * @param style EDIT_STYLE and TEXT_STYLE.
  24. */
  25. public void setFootStyle(int style)
  26. /**
  27. * Set the FootView edit box prompt.
  28. * @param hint
  29. */
  30. public void setFootHint(String hint)
  31. /**
  32. * Set the FootView text.
  33. * @param text
  34. */
  35. public void setFootText(String text)

AUAmountEditText

 
  1. /**
  2. * Get EditText.
  3. * @return
  4. */
  5. public AUEditText getEditText()
  6. /**
  7. * Get input box information.
  8. * @return
  9. */
  10. public Editable getEditTextEditable()
  11. /**
  12. * Set to show or hide the separation line.
  13. * @param visible
  14. */
  15. public void setDividerVisible(boolean visible)
  16. /**
  17. * Set the prompt.
  18. * @param hint
  19. */
  20. public void setHint(String hint)
  21. /**
  22. * Specify whether to display the Delete button.
  23. * @param isShow
  24. */
  25. public void isShowClearIcon(boolean isShow)
  26. /**
  27. * Add focus listening.
  28. * @param listener
  29. */
  30. public void addOnFocusChangeListeners(OnFocusChangeListener listener)
  31. /**
  32. * Bind the external AUNumberKeyboardView ScrollView.
  33. * @param keyboardView
  34. * @param scrollView
  35. */
  36. public void setKeyBoardView(AUNumberKeyboardView keyboardView, ScrollView scrollView)
  37. /**
  38. * Bind the external AUNumberKeyboardView.
  39. * @param keyboardView
  40. */
  41. public void setKeyBoardView(AUNumberKeyboardView keyboardView)

Custom properties

Property Description Type
footStyle Type of header view. editStyle, textStyle
amountTitleText Edit box title. String, Reference
amountHintText Prompt for edit box. String, Reference

Sample code

General code sample

 
  1. <com.alipay.mobile.antui.amount.AUAmountEditText
  2. android:id="@+id/edit_text"
  3. android:layout_width="match_parent"
  4. android:layout_height="wrap_content"
  5. app:amountHintText="Available balance 500.00" />
  6. <com.alipay.mobile.antui.amount.AUAmountLabelText
  7. android:id="@+id/label_text"
  8. android:layout_width="wrap_content"
  9. android:layout_height="wrap_content"
  10. android:layout_gravity="center_horizontal" />
  11. <com.alipay.mobile.antui.amount.AUAmountInputBox
  12. android:id="@+id/amount_input_1"
  13. android:layout_width="match_parent"
  14. android:layout_height="wrap_content"
  15. android:layout_marginTop="10dp"
  16. app:amountTitleText="Transfer amount" />
  17. <com.alipay.mobile.antui.amount.AUAmountInputBox
  18. android:id="@+id/amount_input_2"
  19. android:layout_width="match_parent"
  20. android:layout_height="wrap_content"
  21. android:layout_marginTop="10dp"
  22. app:amountTitleText="Transfer amount"
  23. app:amountHintText="Available balance 500.00"
  24. app:footStyle="textStyle" />
  25. AUAmountInputBox inputBox1 = (AUAmountInputBox)findViewById(R.id.amount_input_1);
  26. inputBox1.setFootHint("Add remark");
  27. AUAmountInputBox inputBox2 = (AUAmountInputBox)findViewById(R.id.amount_input_2);
  28. inputBox2.setFootText("Input not allowed");

Sample code defining a numeric keypad

 
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <com.alipay.mobile.antui.basic.AULinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  3. xmlns:app="http://schemas.android.com/apk/res/com.alipay.mobile.antui"
  4. android:layout_width="match_parent"
  5. android:layout_height="match_parent"
  6. android:orientation="vertical">
  7. <com.alipay.mobile.antui.basic.AUScrollView
  8. android:id="@+id/scroll"
  9. android:layout_weight="1"
  10. android:layout_width="match_parent"
  11. android:layout_height="match_parent">
  12. <com.alipay.mobile.antui.basic.AULinearLayout
  13. android:layout_width="match_parent"
  14. android:layout_height="match_parent"
  15. android:orientation="vertical">
  16. <com.alipay.mobile.antui.amount.AUAmountInputBox
  17. android:id="@+id/amount_input_1"
  18. android:layout_width="match_parent"
  19. android:layout_height="wrap_content"
  20. android:layout_marginTop="10dp"
  21. app:amountTitleText="Transfer amount" />
  22. </com.alipay.mobile.antui.basic.AULinearLayout>
  23. </com.alipay.mobile.antui.basic.AUScrollView>
  24. <com.alipay.mobile.antui.keyboard.AUNumberKeyboardView
  25. android:id="@+id/keyboard"
  26. android:layout_width="match_parent"
  27. android:layout_height="wrap_content"
  28. android:visibility="gone"/>
  29. </com.alipay.mobile.antui.basic.AULinearLayout>
 
  1. // Initialize
  2. keyboardView = (AUNumberKeyboardView) findViewById(R.id.keyboard);
  3. inputBox1 = (AUAmountInputBox)findViewById(R.id.amount_input_1);
  4. ScrollView scrollView = (ScrollView) findViewById(R.id.scroll);
  5. // Bind the keyboard.
  6. inputBox1.getEditLayout().setKeyBoardView(keyboardView, scrollView);