当前位置: 首页>>代码示例>>Java>>正文


Java TextView.removeTextChangedListener方法代码示例

本文整理汇总了Java中android.widget.TextView.removeTextChangedListener方法的典型用法代码示例。如果您正苦于以下问题:Java TextView.removeTextChangedListener方法的具体用法?Java TextView.removeTextChangedListener怎么用?Java TextView.removeTextChangedListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.TextView的用法示例。


在下文中一共展示了TextView.removeTextChangedListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onItemSelected

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onItemSelected(AdapterView<?> parent, View view,
                           int pos, long id)
{
    // An item was selected. You can retrieve the selected item
    // using parent.getItemAtPosition(pos)
    // Check id
    switch (parent.getId())
    {
    case R.id.spinner:
        String item = (String)parent.getItemAtPosition(pos);

        // Get length
        length = Integer.parseInt(item);

        // Remove the unused slots
        if (letters != null)
        {
            for (int i = 0; i < letters.getChildCount(); i++)
            {
                TextView text = (TextView)letters.getChildAt(i);
                if (i < length)
                    text.setVisibility(View.VISIBLE);

                // Temporarily remove the text change listener to
                // stop unexpected consequences
                else
                {
                    text.setVisibility(View.GONE);
                    text.removeTextChangedListener(this);
                    text.setText("");
                    text.addTextChangedListener(this);
                }
            }
        }
    }
}
 
开发者ID:billthefarmer,项目名称:crossword,代码行数:38,代码来源:Main.java

示例2: onItemClick

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view,
                        int position, long id)
{
    // An item was selected. You can retrieve the selected item
    // using parent.getItemAtPosition(pos)
    // Check id
    switch (parent.getId())
    {
    case R.id.list:
        String word = (String)parent.getItemAtPosition(position);
        String s = word.toUpperCase(Locale.getDefault());

        // Fill the letters in the slots and temporarily remove
        // the text change listener to stop unexpected
        // consequences
        for (int i = 0; i < length; i++)
        {
            TextView text = (TextView)letters.getChildAt(i);
            text.removeTextChangedListener(this);
            text.setText(s.substring(i, i + 1));
            text.addTextChangedListener(this);
        }

        // Start the web search
        Intent intent = new Intent(this, SearchActivity.class);
        intent.putExtra(WORD, word);
        startActivity(intent);
    }
}
 
开发者ID:billthefarmer,项目名称:crossword,代码行数:31,代码来源:Main.java

示例3: doClear

import android.widget.TextView; //导入方法依赖的package包/类
private void doClear()
{
    // Temporarily remove the text change listener to stop
    // unexpected consequences
    for (int i = 0; i < length; i++)
    {
        TextView text = (TextView)letters.getChildAt(i);
        text.removeTextChangedListener(this);
        text.setText("");
        text.addTextChangedListener(this);
    }
}
 
开发者ID:billthefarmer,项目名称:crossword,代码行数:13,代码来源:Main.java

示例4: removeTextWatcher

import android.widget.TextView; //导入方法依赖的package包/类
private static void removeTextWatcher(TextView textView) {
    textView.removeTextChangedListener(
            (TextWatcher) textView.getTag(R.id.onTextChangedListener)
    );
    textView.setTag(R.id.onTextChangedListener, null);
}
 
开发者ID:dmitry-zaitsev,项目名称:BlueTape,代码行数:7,代码来源:TextChangedBindingFunction.java


注:本文中的android.widget.TextView.removeTextChangedListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。