我在ExpandableListView的每个子项中都有一个EditText, 但是有一个问题: 当我单击EditText时,有时光标正常闪烁, 但有时光标不会出现, 或者光标出现但不闪烁。
我尝试了很多方法,但没有人工作。
以下是我尝试但不工作的方式:
为Java中的子项的每个EditText设置
View.OnFocusChangeListener onFocus = new View.OnFocusChangeListener() {
@Override
public void onFocusChange(View v, boolean hasFocus) {
v.dispatchWindowFocusChanged(hasFocus);
}
};
为ExpandableListView设置
android:descendantFocusability="afterDescendants"
android:focusable="false"
为xml中的子项设置
android:textCursorDrawable="@null"
android:cursorVisible="true"
我不知道这个问题,请帮助,非常感谢~~~
答案 0 :(得分:0)
当我发现Handler
内部无效计时器因某种原因停止时发生了这种情况。我不知道为什么。
我所能做的就是创建自己的EditText
以使我的课程内的视图无效@Override
protected void onFocusChanged(boolean focused, int direction, Rect previouslyFocusedRect) {
super.onFocusChanged(focused, direction, previouslyFocusedRect);
if(focused) {
handler.postDelayed(this, 200);
} else {
handler.removeCallbacks(this);
}
}
@Override
public void run() {
invalidate();
new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(250);
if(hasFocus()) {
handler.post(MyEditText.this);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}).start();
}
。
@Bean
public IntegrationFlow processProduct() {
return IntegrationFlows.from(mongoMessageSource(mongoDbFactory),
c -> c.poller(Pollers.cron(cron)))
.enrichHeaders(m -> m.header("errorChannel", deleteFileErrorChannel))
.split()
.channel(deleteFileChannel())
.get();
}
@Bean
public MessageSource<Object> mongoMessageSource(MongoDbFactory mongo) {
long innerBoundary = Instant.now().toEpochMilli();
long outerBoundary = Instant.now().plus(XXXXX).toEpochMilli();
log.info("Delete file with modification date between {} and {}", outerBoundary, innerBoundary);
String expression = new StringBuilder()
.append("{value: { $gte: \"")
.append(outerBoundary)
.append("\", $lt : \"")
.append(innerBoundary)
.append("\"}}")
.toString();
log.info("Running mongo query {}", expression);
MongoDbMessageSource messageSource = new MongoDbMessageSource(mongo, new LiteralExpression(expression));
messageSource.setExpectSingleResult(false);
messageSource.setEntityClass(MetaDataStore.class);
messageSource.setCollectionNameExpression(new LiteralExpression("treated_file"));
return messageSource;
}
@Bean
public IntegrationFlow deleteFileFlow() {
return IntegrationFlows.from(deleteFileChannel())
//Add file name and directory to header
.enrichHeaders(m -> m
.header("file_remoteDirectory", sourceFtpDirectory)
.headerExpression("file_remoteFile", "payload.id")
)
//Delete files
.handle(Sftp
.outboundGateway(
sourceFtpSessionFactory,
AbstractRemoteFileOutboundGateway.Command.RM,
"headers['file_remoteDirectory'] + '/' + headers['file_remoteFile']")
)
.get();
}
我不认为这是一个很好的解决方案。如果你知道的更好,请写下来。