当我的应用程序可见时,我每次关闭屏幕时都会收到一个InputConnectionWrapper警告。我不知道为什么,因为我不使用InputConnection
。
这是LogCat的输出。
09-07 14:21:31.716: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:31.724: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): beginBatchEdit on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): endBatchEdit on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): beginBatchEdit on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): endBatchEdit on inactive InputConnection
09-07 14:21:31.732: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.013: W/IInputConnectionWrapper(24197): showStatusIcon on inactive InputConnection
09-07 14:21:32.013: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): beginBatchEdit on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): endBatchEdit on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextBeforeCursor on inactive InputConnection
09-07 14:21:32.021: W/IInputConnectionWrapper(24197): getTextAfterCursor on inactive InputConnection
09-07 14:21:32.028: W/IInputConnectionWrapper(24197): beginBatchEdit on inactive InputConnection
09-07 14:21:32.028: W/IInputConnectionWrapper(24197): endBatchEdit on inactive InputConnection
09-07 14:21:32.028: W/IInputConnectionWrapper(24197): getExtractedText on inactive InputConnection
发布于 2016-11-09 04:13:09
在我的例子中,在按钮布局中,我有这个:android:textIsSelectable="true"
,只要移除它,问题就解决了……
发布于 2020-10-19 18:24:32
我正在使用webView浏览需要注册或登录的网址。当我将焦点切换到不同的TextField时,我的应用程序就死机了,我得到了上面同样的错误。
我设法解决这个问题的方法是,它缺少下面这段关键代码:
@override
void initState() {
super.initState();
if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView();
}
这段代码应该位于扩展主类的实例类的声明之后,并且在build Widget函数之前。
在错误日志中,您可能仍然会看到相同的警告,但它肯定会解决导致的任何问题,无论是Swift键盘还是TextFields本身。
发布于 2019-07-11 16:46:37
TextWatcher textWatcherContent = new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
}
@Override
public void afterTextChanged(Editable s) {
String content = mTxtContent.getText().toString();
String contact = mTxtContact.getText().toString();
if (null != mTxtContent && null != mTxtLength) {
int length = mTxtContent.getText().toString().length();
if (length > 200) {
mTxtContent.removeTextChangedListener(textWatcherContent);
SpannableString spannableString = new SpannableString(content);
spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#FF3838")), 200
, mTxtContent.length() , Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
mTxtContent.getText().clear();
mTxtContent.append(spannableString);
mTxtContent.setSelection(content.length());
mTxtContent.addTextChangedListener(textWatcherContent);
}
}
}
};
https://stackoverflow.com/questions/12318521
复制相似问题