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


Java TextView.setOnEditorActionListener方法代码示例

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


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

示例1: addEditorActionListener

import android.widget.TextView; //导入方法依赖的package包/类
protected final void addEditorActionListener(TextView.OnEditorActionListener listener) {
  TextView view;
  if (listener != null && (view = getHostView()) != null) {
    if (mEditorActionListeners == null) {
      mEditorActionListeners = new ArrayList<>();
      view.setOnEditorActionListener(new TextView.OnEditorActionListener() {
        private boolean handled = true;

        @Override
        public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
          for (TextView.OnEditorActionListener l : mEditorActionListeners) {
            if (l != null) {
              handled = handled & l.onEditorAction(v, actionId, event);
            }
          }
          return handled;
        }
      });
    }
    mEditorActionListeners.add(listener);
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:23,代码来源:AbstractEditComponent.java

示例2: onCreate

import android.widget.TextView; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);

    // Get preferences
    SharedPreferences preferences =
        PreferenceManager.getDefaultSharedPreferences(this);
    dark = preferences.getBoolean(PREF_DARK, false);

    if (dark)
        setTheme(R.style.AppDarkTheme);

    setContentView(R.layout.main);

    // Find views
    spinner = (Spinner)findViewById(R.id.spinner);
    letters = (ViewGroup)findViewById(R.id.letters);
    results = (ListView)findViewById(R.id.list);
    clear = (Button)findViewById(R.id.clear);
    search = (Button)findViewById(R.id.search);

    // Set up listeners
    if (spinner != null)
    {
        spinner.setSelection(LETTERS - 1);
        spinner.setOnItemSelectedListener(this);
    }

    if (clear != null)
        clear.setOnClickListener(this);

    if (search != null)
        search.setOnClickListener(this);

    // Set up letter slots
    if (letters != null)
    {
        for (int i = 0; i < letters.getChildCount(); i++)
        {
            TextView letter = (TextView)letters.getChildAt(i);
            if (i < LETTERS)
                letter.setVisibility(View.VISIBLE);

            else
            {
                letter.setVisibility(View.GONE);
                letter.setText("");
            }

            // Add listeners
            letter.setOnEditorActionListener(this);
            letter.addTextChangedListener(this);
        }
    }

    if (results != null)
        results.setOnItemClickListener(this);

    // Get data instance
    data = Data.getInstance(this);

    // Restore result list
    if (data != null)
        resultList = data.getResultList();

    if (resultList == null)
        resultList = new ArrayList<String>();

    // Create adapter
    adapter =
        new ArrayAdapter<String>(this,
                                 android.R.layout.simple_list_item_1,
                                 resultList);
    if (results != null)
        results.setAdapter(adapter);
}
 
开发者ID:billthefarmer,项目名称:crossword,代码行数:78,代码来源:Main.java


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