本文整理了Java中android.widget.EditText.onEditorAction()
方法的一些代码示例,展示了EditText.onEditorAction()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EditText.onEditorAction()
方法的具体详情如下:
包路径:android.widget.EditText
类名称:EditText
方法名:onEditorAction
暂无
代码示例来源:origin: RobotiumTech/robotium
public void run()
{
freshestEditText.onEditorAction(imeAction);
}
});
代码示例来源:origin: stackoverflow.com
final EditText editText = (EditText) findViewById(R.id.textView);
editText.setOnEditorActionListener(clickedEnter);
Button button = (Button) findViewById(R.id.button);
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
editText.onEditorAction(EditorInfo.IME_ACTION_DONE);
}
});
代码示例来源:origin: com.jayway.android.robotium/robotium-solo
public void run()
{
freshestEditText.onEditorAction(imeAction);
}
});
代码示例来源:origin: stackoverflow.com
public void pressSoftKeyboardNextButton(){
final EditText freshestEditText = viewFetcher.getFreshestView(viewFetcher.getCurrentViews(EditText.class));
if(freshestEditText != null){
inst.runOnMainSync(new Runnable()
{
public void run()
{
freshestEditText.onEditorAction(EditorInfo.IME_ACTION_NEXT);
}
});
}
}
代码示例来源:origin: halzhang/EverExample
@Override
public void onEditorAction(int actionCode) {
super.onEditorAction(actionCode);
if (actionCode == EditorInfo.IME_ACTION_DONE) {
clearFocus();
}
}
}
代码示例来源:origin: MiEcosystem/mijiaSDK
@Override
public void onEditorAction(int actionCode) {
super.onEditorAction(actionCode);
if (actionCode == EditorInfo.IME_ACTION_DONE) {
clearFocus();
}
}
}
代码示例来源:origin: stackoverflow.com
public void testImeNext() throws Exception
{
//Grab a reference to your EditText. This code grabs the first Edit Text in the Activity
//Alternatively, you can get the EditText by resource id or using a method like getCurrentEditTexts()
//Make sure it's final, we'll need it in a nested block of code.
final EditText editText = solo.getEditText(0);
//Create a runnable which triggers the onEditorAction callback
Runnable runnable = new Runnable()
{
@Override
public void run()
{
editText.onEditorAction(EditorInfo.IME_ACTION_NEXT);
}
};
//Use Solo to get the current activity, and pass our runnable to the UI thread.
solo.getCurrentActivity().runOnUiThread(runnable);
}
代码示例来源:origin: stackoverflow.com
/**
* This will send the NEXT action to simulate pressing next on the keyboard.
* Because it has to be run on the UI thread we use a barrier to block and
* stop this request returning until the action is complete.
**/
private void sendIMENext(final EditText editText) throws Exception {
final CyclicBarrier barrier = new CyclicBarrier(2);
Runnable runnable = new Runnable() {
@Override
public void run() {
editText.onEditorAction(EditorInfo.IME_ACTION_NEXT);
try {
barrier.await();
}
catch (Exception e) {
Log.e("MainActivityTest", "Interupted on UI thread pressing IME next", e);
}
}
};
//Use Solo to get the current activity, and pass our runnable to the UI thread.
solo.getCurrentActivity().runOnUiThread(runnable);
// Waits until the barrier is met in the runnable
barrier.await();
}
代码示例来源:origin: stackoverflow.com
public static void pressEnter(Instrumentation instrumentation, final EditText editText)
{
instrumentation.runOnMainSync(new Runnable() {
@Override
public void run() {
editText.onEditorAction(EditorInfo.IME_ACTION_DONE);
}
});
instrumentation.waitForIdleSync();
}
内容来源于网络,如有侵权,请联系作者删除!