可绘制的左动画

时间:2020-02-29 22:31:43

标签: java android

我想为文本视图制作一个可绘制的左动画 这是带有我要更改图标的textviewthe Tick icon

如果输入的电子邮件有效,我想做的就是将图标的颜色设置为红色 代码是:

   public class Signup extends AppCompatActivity
{
    String validemail = "[a-zA-Z0-9\\+\\.\\_\\%\\-\\+]{1,256}" +

            "\\@" +

            "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,64}" +

            "(" +

            "\\." +

            "[a-zA-Z0-9][a-zA-Z0-9\\-]{0,25}" +

            ")+";

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        EditText email;
        super.onCreate (savedInstanceState);
        setContentView (R.layout.activity_signup);
        email = findViewById(R.id.useremailadress);

        TextView checkboxtext = findViewById(R.id.checkBox);
        String cbtext = "لقد قرأت ووافقت على شروط الاستخدام"; // I have read and agree to the terms of use
        SpannableString ss = new SpannableString(cbtext);
        ClickableSpan termsandcond = new ClickableSpan() 
        {
            @Override
            public void onClick(@NonNull View widget)
            {
                openTermConditions();
            }
        };
        ss.setSpan(termsandcond, 20, 34, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        checkboxtext.setText(ss);
        checkboxtext.setMovementMethod(LinkMovementMethod.getInstance());
        String emailadress = email.getText().toString();
        Matcher matcher= Pattern.compile(validemail).matcher(emailadress);



        if (matcher.matches())
        {
            //Add the animation Here

        }

    }
    private void openTermConditions() {
        Intent intent = new Intent(this, TermsConditions.class);
        startActivity(intent);
    }
}

0 个答案:

没有答案