本文整理了Java中android.widget.TextView.setOnEditorActionListener()
方法的一些代码示例,展示了TextView.setOnEditorActionListener()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextView.setOnEditorActionListener()
方法的具体详情如下:
包路径:android.widget.TextView
类名称:TextView
方法名:setOnEditorActionListener
暂无
代码示例来源:origin: iSoron/uhabits
public static void setupEditorAction(@NonNull ViewGroup parent,
@NonNull TextView.OnEditorActionListener listener)
{
for (int i = 0; i < parent.getChildCount(); i++)
{
View child = parent.getChildAt(i);
if (child instanceof ViewGroup)
setupEditorAction((ViewGroup) child, listener);
if (child instanceof TextView)
((TextView) child).setOnEditorActionListener(listener);
}
}
代码示例来源:origin: robolectric/robolectric
@Implementation
protected void setOnEditorActionListener(TextView.OnEditorActionListener l) {
this.onEditorActionListener = l;
directlyOn(realTextView, TextView.class).setOnEditorActionListener(l);
}
代码示例来源:origin: facebook/stetho
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.irc_chat_activity);
mConsoleDisplay = (ListView) findViewById(R.id.console_display);
mConsoleRowAdapter = new IRCConsoleRowAdapter(this);
mConsoleDisplay.setAdapter(mConsoleRowAdapter);
mConsoleInput = (TextView) findViewById(R.id.console_input);
mConsoleInput.setOnEditorActionListener(mOnConsoleInputEditorAction);
findViewById(R.id.console_send).setOnClickListener(mConsoleSendClicked);
// Will re-enable once we connect...
mConsoleInput.setEnabled(false);
mSimpleIRCConnectionManager = new SimpleIRCConnectionManager(
getIntent().getStringExtra(EXTRA_HOST_AND_MAYBE_PORT),
getIntent().getStringExtra(EXTRA_NICKNAME));
mConnectionExecutor = Executors.newCachedThreadPool();
mConnectionExecutor.execute(new Runnable() {
@Override
public void run() {
mSimpleIRCConnectionManager.runConnectLoop();
}
});
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldTriggerTheImeListener() {
TestOnEditorActionListener actionListener = new TestOnEditorActionListener();
textView.setOnEditorActionListener(actionListener);
textView.onEditorAction(EditorInfo.IME_ACTION_GO);
assertThat(actionListener.textView).isSameAs(textView);
assertThat(actionListener.sentImeId).isEqualTo(EditorInfo.IME_ACTION_GO);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void shouldCreateGetterForEditorActionListener() {
TestOnEditorActionListener actionListener = new TestOnEditorActionListener();
textView.setOnEditorActionListener(actionListener);
assertThat(shadowOf(textView).getOnEditorActionListener()).isSameAs(actionListener);
}
代码示例来源:origin: zhiqiangli520210/-nice-
/**
* 初始化事件
**/
protected void initEvents() {
etPictureTagLabel.setOnEditorActionListener(this);
}
代码示例来源:origin: PrivacyApps/document-viewer
public ActionEx connectEditorToAction(final TextView view, final int onEditActionId) {
ActionEx action = getOrCreateAction(onEditActionId);
view.setOnEditorActionListener(action);
return action;
}
代码示例来源:origin: stripe/stripe-android
private void initEnterListeners() {
((TextView) mCardMultilineWidget.findViewById(R.id.et_add_source_card_number_ml))
.setOnEditorActionListener(mOnEditorActionListener);
((TextView) mCardMultilineWidget.findViewById(R.id.et_add_source_expiry_ml))
.setOnEditorActionListener(mOnEditorActionListener);
((TextView) mCardMultilineWidget.findViewById(R.id.et_add_source_cvc_ml))
.setOnEditorActionListener(mOnEditorActionListener);
((TextView) mCardMultilineWidget.findViewById(R.id.et_add_source_postal_ml))
.setOnEditorActionListener(mOnEditorActionListener);
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Override protected void onUnsubscribe() {
view.setOnEditorActionListener(null);
}
});
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Override protected void onUnsubscribe() {
view.setOnEditorActionListener(null);
}
});
代码示例来源:origin: stackoverflow.com
private void findTextViews(ViewGroup parent) {
final int count = parent.getChildCount();
for (int i = 0; i < count; i++) {
final View child = parent.getChildAt(i);
if (child instanceof ViewGroup) {
findTextViews((ViewGroup) child);
} else if (child instanceof TextView) {
mTargets.add((TextView) child);
}
}
}
private void setupEditorListener() {
final int count = mTargets.size();
for (int i = 0; i < count; i++) {
final TextView target = mTargets.get(i);
target.setOnEditorActionListener(mListener);
}
}
代码示例来源:origin: org.robolectric/framework
@Implementation
public void setOnEditorActionListener(TextView.OnEditorActionListener l) {
this.onEditorActionListener = l;
directlyOn(realTextView, TextView.class).setOnEditorActionListener(l);
}
代码示例来源:origin: redfish64/TinyTravelTracker
passwordEditText.setOnEditorActionListener(onEditorActionListener);
代码示例来源:origin: org.robolectric/shadows-core
@Implementation
public void setOnEditorActionListener(TextView.OnEditorActionListener l) {
this.onEditorActionListener = l;
directlyOn(realTextView, TextView.class).setOnEditorActionListener(l);
}
代码示例来源:origin: org.robolectric/shadows-core-v23
@Implementation
public void setOnEditorActionListener(TextView.OnEditorActionListener l) {
this.onEditorActionListener = l;
directlyOn(realTextView, TextView.class).setOnEditorActionListener(l);
}
代码示例来源:origin: org.robolectric/shadows-framework
@Implementation
protected void setOnEditorActionListener(TextView.OnEditorActionListener l) {
this.onEditorActionListener = l;
directlyOn(realTextView, TextView.class).setOnEditorActionListener(l);
}
代码示例来源:origin: ImangazalievM/ReActiveAndroid
public NewFolderViewHolder(FoldersEditAdapter adapter, View itemView) {
super(itemView);
this.adapter = adapter;
this.leftButton = itemView.findViewById(R.id.left_button);
this.folderName = itemView.findViewById(R.id.folder_name_text);
this.doneButton = itemView.findViewById(R.id.done_button);
this.focusHolder = itemView.findViewById(R.id.focus_holder);
folderName.setOnFocusChangeListener((v, hasFocus) -> {
if (hasFocus) {
open();
}
});
folderName.setOnEditorActionListener((v, actionId, event) -> {
if (actionId == EditorInfo.IME_ACTION_DONE) {
onDoneButtonClick();
return true;
}
return false;
});
leftButton.setOnClickListener(view -> onLeftButtonClick());
doneButton.setOnClickListener(view -> onDoneButtonClick());
}
代码示例来源:origin: androidmalin/ILOVEYOU
/**
* Remove an onclick listener
*/
public static void unBingListener(View view) {
if (view != null) {
try {
if (view.hasOnClickListeners()) {
view.setOnClickListener(null);
}
if (view instanceof TextView){
((TextView) view).addTextChangedListener(null);
((TextView) view).setOnEditorActionListener(null);
}
if (view.getOnFocusChangeListener() != null) {
view.setOnFocusChangeListener(null);
}
if (view instanceof ViewGroup && !(view instanceof AdapterView)) {
ViewGroup viewGroup = (ViewGroup) view;
int viewGroupChildCount = viewGroup.getChildCount();
for (int i = 0; i < viewGroupChildCount; i++) {
unBingListener(viewGroup.getChildAt(i));
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Override public void call(final Subscriber<? super Integer> subscriber) {
verifyMainThread();
TextView.OnEditorActionListener listener = new TextView.OnEditorActionListener() {
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (handled.call(actionId)) {
if (!subscriber.isUnsubscribed()) {
subscriber.onNext(actionId);
}
return true;
}
return false;
}
};
subscriber.add(new MainThreadSubscription() {
@Override protected void onUnsubscribe() {
view.setOnEditorActionListener(null);
}
});
view.setOnEditorActionListener(listener);
}
}
代码示例来源:origin: nurkiewicz/rxjava-book-examples
@Override public void call(final Subscriber<? super TextViewEditorActionEvent> subscriber) {
verifyMainThread();
TextView.OnEditorActionListener listener = new TextView.OnEditorActionListener() {
@Override public boolean onEditorAction(TextView v, int actionId, KeyEvent keyEvent) {
TextViewEditorActionEvent event = TextViewEditorActionEvent.create(v, actionId, keyEvent);
if (handled.call(event)) {
if (!subscriber.isUnsubscribed()) {
subscriber.onNext(event);
}
return true;
}
return false;
}
};
subscriber.add(new MainThreadSubscription() {
@Override protected void onUnsubscribe() {
view.setOnEditorActionListener(null);
}
});
view.setOnEditorActionListener(listener);
}
}
内容来源于网络,如有侵权,请联系作者删除!