设为首页 加入收藏

TOP

Android 避免2个相互影响的 EditText 死循环
2014-11-24 08:27:27 来源: 作者: 【 】 浏览:1
Tags:Android 避免 相互 影响 EditText 循环

etExchangeRateEn = (EditText) findViewById(R.id.etExchangeRateEn);
etExchangeRateCn = (EditText) findViewById(R.id.etExchangeRateCn);


twEN = new TextWatcher()
{


@Override
public void afterTextChanged(Editable s)
{
etExchangeRateCn.addTextChangedListener(twCN);
}


@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{


}


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


etExchangeRateCn.setText( "CN");


}


};


twCN = new TextWatcher()
{


@Override
public void afterTextChanged(Editable s)
{
etExchangeRateEn.addTextChangedListener(twEN);


}


@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after)
{
}


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


etExchangeRateEn.setText("EN");


}
};
etExchangeRateEn.addTextChangedListener(twEN);
etExchangeRateCn.addTextChangedListener(twCN);


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Android SharedPreferences 存储.. 下一篇在iOS中特定形状剪裁图片的实现

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容:

·如何从内核协议栈到 (2025-12-27 03:19:09)
·什么是网络协议?有哪 (2025-12-27 03:19:06)
·TCP/ IP协议有哪些 (2025-12-27 03:19:03)
·怎样用 Python 写一 (2025-12-27 02:49:19)
·如何学习python数据 (2025-12-27 02:49:16)