コード例 #1
0
  /** @Description: 瓷砖特效 */
  private void initMaterialRipple() {
    alimonyET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    // 设置验证信息
    alimonyET.addValidator(
        new METValidator("请输入整数~") {

          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            String number = text.toString();
            if ("".equals(number) || VerifyUtils.isDigit(number)) {
              return true;
            }
            return false;
          }
        });
    // 动态特效
    MaterialRippleLayout.on(commitBtn)
        .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_DARK))
        .rippleAlpha(CommonConstant.RIPPLE_ALPHA)
        .rippleHover(true)
        .create();
  }
コード例 #2
0
  /** @Description: 瓷砖特效 */
  private void initMaterialRipple() {
    // 设置Spinner的Adapter
    String[] types = getResources().getStringArray(R.array.second_hand_type);
    List<String> typeList = Arrays.asList(types);
    MyArrayAdapter typeAdapter = new MyArrayAdapter(this, typeList);
    typeSp.setAdapter(typeAdapter);
    String[] bargains = getResources().getStringArray(R.array.second_hand_bargain);
    List<String> bargainList = Arrays.asList(bargains);
    MyArrayAdapter bargainAdapter = new MyArrayAdapter(this, bargainList);
    bargainSp.setAdapter(bargainAdapter);
    // 设置Padding
    titleET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    typeSp.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    priceET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    describeET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    bargainSp.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    qqET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    phoneET.setPaddings(DensityUtils.sp2px(this, 32), 0, 0, 0);
    // 设置验证信息
    priceET.addValidator(
        new METValidator("只能输入整数~") {

          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            String number = text.toString();
            if ("".equals(number) || VerifyUtils.isDigit(number)) {
              return true;
            }
            return false;
          }
        });
    qqET.addValidator(
        new METValidator("请输入正确的QQ格式~") {

          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            String number = text.toString();
            if ("".equals(number) || VerifyUtils.isDigit(number)) {
              return true;
            }
            return false;
          }
        });
    phoneET.addValidator(
        new METValidator("请输入正确的联系号码格式~") {

          @Override
          public boolean isValid(@NonNull CharSequence text, boolean isEmpty) {
            String number = text.toString();
            if ("".equals(number) || VerifyUtils.checkPhone(number)) {
              return true;
            }
            return false;
          }
        });

    // 动态特效
    MaterialRippleLayout.on(itemTitleRL)
        .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_LITHT))
        .rippleAlpha(CommonConstant.RIPPLE_ALPHA)
        .rippleHover(true)
        .create();
    MaterialRippleLayout.on(contactTitleRL)
        .rippleColor(Color.parseColor(CommonConstant.RIPPLE_COLOR_LITHT))
        .rippleAlpha(CommonConstant.RIPPLE_ALPHA)
        .rippleHover(true)
        .create();
  }