我尝试了多种方法来从我的测试中禁用软键盘,但没有奏效。
添加到我的 androidmanifest.xml
<activity android:name="com.photos.ui.activity.WelcomeActivity" android:windowSoftInputMode="stateHidden" />
活动是应用程序文件夹的名称(不是我的测试脚本)
添加到我的 androidmanifest.xml
<LinearLayout android:focusable="true" android:focusableInTouchMode="true"
/>
把它放在我的测试和我的设置中
EditText edtView=solo.getEditText(0); edtView.setInputType(InputType.TYPE_NULL);
试过了
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(solo.getEditText(0).getWindowToken(),0);
但 getSystemService 给了我一个错误。(在我的课堂上未定义)我不知道如何使用这两个命令
我正在使用 2.3 和三星展览 II。
现在我正在使用:
hnm, what calls would I need to create the context object? right now im using: private Context context;
private static Class<?> launcherActivityClass;
static{
try {
launcherActivityClass = Class.forName(LAUNCHER_ACTIVITY_FULL_CLASSNAME);
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
}
public TestMain() throws ClassNotFoundException {
super(TARGET_PACKAGE_ID, launcherActivityClass);
}
public TestMain(String name) throws ClassNotFoundException {
super(TARGET_PACKAGE_ID, launcherActivityClass);
setName(name);
}
public TestMain(String name, Class<?> className) throws ClassNotFoundException {
super(TARGET_PACKAGE_ID, className);
setName(name);
}
private Solo solo;
@Override
protected void setUp() throws Exception {
solo = new Solo(getInstrumentation(), getActivity());
Log.v("setup","setup");
}
@Override
protected void tearDown() throws Exception {
solo.finishOpenedActivities();
}
谢谢。