當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。