android中如何获取两个EditText的同时值?

发布于 2024-12-08 15:36:25 字数 10367 浏览 0 评论 0原文

我想将 Edittext 设置为这样,无论我在 EditText 中写入和输入什么,它都应该同时写入 TextView 中。

我认为添加任何 istener 都是可能的。 我无法实施它。所以请任何人帮助我。 ? 谢谢。

 includedText.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

                if(!(includedText.getText().toString().equals("")))
                {
                    double included = Double.parseDouble(includedText.getText().toString());
                    included = roundTwoDecimals(included);
        //          double amountValue = (excluded*15/100);

                    String amt = String.valueOf(roundTwoDecimals(included-(included/1.15)));
                    String excluded = String.valueOf(included/1.15);
                    System.out.println("The Amount is: "+amt);
                    amountText.setText(amt);
                    try{
                        excludedText.setText(excluded); //////// Error
                    }
                    catch(Exception e)
                    {
                        e.printStackTrace();
                    }
                }
                else
                {
                    amountText.setText("");
                    //excludedText.setText("");
                }

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

        }
    });

    excludedText.addTextChangedListener(new TextWatcher() 
    {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if(!(excludedText.getText().toString().equals("")))
            {
                double excluded = Double.parseDouble(excludedText.getText().toString());
                excluded = roundTwoDecimals(excluded);
        //      double amountValue = (excluded*15/100);

                String amt = String.valueOf(roundTwoDecimals(excluded*0.15));
                String included = String.valueOf(roundTwoDecimals(excluded+(excluded*0.15)));
                System.out.println("The Amount is: "+amt);
                amountText.setText(amt);
                includedText.setText(included);
            }
            else
            {
                amountText.setText("");
                includedText.setText("");
            }

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

        }
    });

日志猫:

    10-08 10:34:27.239: ERROR/AndroidRuntime(662): FATAL EXCEPTION: main
10-08 10:34:27.239: ERROR/AndroidRuntime(662): java.lang.StackOverflowError
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.text.DynamicLayout.reflow(DynamicLayout.java:261)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.text.DynamicLayout.<init>(DynamicLayout.java:150)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.makeNewLayout(TextView.java:4851)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.checkForRelayout(TextView.java:5348)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2688)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextVie

I want to set the Edittext as like, whatever i write and enter in to the EditText, it should be written in to the TextView at the same Moment.

I think it can be possible by adding any istener.
I am not able to implement it. So Please anyone help me in this . ?
thanks.

 includedText.addTextChangedListener(new TextWatcher() {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {

                if(!(includedText.getText().toString().equals("")))
                {
                    double included = Double.parseDouble(includedText.getText().toString());
                    included = roundTwoDecimals(included);
        //          double amountValue = (excluded*15/100);

                    String amt = String.valueOf(roundTwoDecimals(included-(included/1.15)));
                    String excluded = String.valueOf(included/1.15);
                    System.out.println("The Amount is: "+amt);
                    amountText.setText(amt);
                    try{
                        excludedText.setText(excluded); //////// Error
                    }
                    catch(Exception e)
                    {
                        e.printStackTrace();
                    }
                }
                else
                {
                    amountText.setText("");
                    //excludedText.setText("");
                }

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

        }
    });

    excludedText.addTextChangedListener(new TextWatcher() 
    {

        @Override
        public void onTextChanged(CharSequence s, int start, int before, int count) {
            if(!(excludedText.getText().toString().equals("")))
            {
                double excluded = Double.parseDouble(excludedText.getText().toString());
                excluded = roundTwoDecimals(excluded);
        //      double amountValue = (excluded*15/100);

                String amt = String.valueOf(roundTwoDecimals(excluded*0.15));
                String included = String.valueOf(roundTwoDecimals(excluded+(excluded*0.15)));
                System.out.println("The Amount is: "+amt);
                amountText.setText(amt);
                includedText.setText(included);
            }
            else
            {
                amountText.setText("");
                includedText.setText("");
            }

        }

        @Override
        public void beforeTextChanged(CharSequence s, int start, int count,
                int after) {
            // TODO Auto-generated method stub

        }

        @Override
        public void afterTextChanged(Editable s) {
            // TODO Auto-generated method stub

        }
    });

Logcat:

    10-08 10:34:27.239: ERROR/AndroidRuntime(662): FATAL EXCEPTION: main
10-08 10:34:27.239: ERROR/AndroidRuntime(662): java.lang.StackOverflowError
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.text.DynamicLayout.reflow(DynamicLayout.java:261)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.text.DynamicLayout.<init>(DynamicLayout.java:150)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.makeNewLayout(TextView.java:4851)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.checkForRelayout(TextView.java:5348)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2688)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$1.onTextChanged(GSTActivity.java:66)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2556)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.EditText.setText(EditText.java:75)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2531)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at com.project.TaxCalculator.GSTActivity$2.onTextChanged(GSTActivity.java:110)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.sendOnTextChanged(TextView.java:6131)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextView.setText(TextView.java:2691)
10-08 10:34:27.239: ERROR/AndroidRuntime(662):     at android.widget.TextVie

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

夏雨凉 2024-12-15 15:36:25

在您的 EditText 上使用 addTextChangedListener 方法,并使您的类实现或定义一个实现 TextWatcher 类的内部类:

textMessage = (EditText)findViewById(R.id.textMessage);
    textMessage.addTextChangedListener(new TextWatcher(){
        public void afterTextChanged(Editable s) {

}
        public void beforeTextChanged(CharSequence s, int start, int count, int after){}
        public void onTextChanged(CharSequence s, int start, int before, int count){}
    }); 

更多 :: Android:如何获取 EditText 更改?

Use the addTextChangedListener method on your EditText and make your class implement or define an inner class implementing the TextWatcher class:

textMessage = (EditText)findViewById(R.id.textMessage);
    textMessage.addTextChangedListener(new TextWatcher(){
        public void afterTextChanged(Editable s) {

}
        public void beforeTextChanged(CharSequence s, int start, int count, int after){}
        public void onTextChanged(CharSequence s, int start, int before, int count){}
    }); 

For more :: Android: How can I get EditText change?

北城半夏 2024-12-15 15:36:25
TextView mTextView= (TextView )findViewById(R.id.textview);
EditText mEditText = (EditText)findViewById(R.id.edittext);
    mEditText .addTextChangedListener(new TextWatcher(){
        public void afterTextChanged(Editable s) {

}
        public void beforeTextChanged(CharSequence s, int start, int count, int after){}
        public void onTextChanged(CharSequence s, int start, int before, int count){
      mTextView.setText(s.toString);
}
}); 
TextView mTextView= (TextView )findViewById(R.id.textview);
EditText mEditText = (EditText)findViewById(R.id.edittext);
    mEditText .addTextChangedListener(new TextWatcher(){
        public void afterTextChanged(Editable s) {

}
        public void beforeTextChanged(CharSequence s, int start, int count, int after){}
        public void onTextChanged(CharSequence s, int start, int before, int count){
      mTextView.setText(s.toString);
}
}); 
鹿港巷口少年归 2024-12-15 15:36:25

你必须实现 android.text.method.Keylistener
您可以在其中获得各种回调方法。根据您的需要选择一种方法。

享受..

You have to implement android.text.method.Keylistener
where you get varios callback methods. Choose a method as per your needs.

Enjoy..

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文