我有一个共同的EditText.这很奇怪,因为我在使用硬键盘时无法集中注意力.上下文条件:
要获得焦点:按Dpad,您将看到焦点从屏幕中的第一个小部件开始.最后关注目标EditText.然后你可以输入.没有这个,你根本不能输入硬键盘.
软键盘没有这样的焦点问题.
我正在使用android 2.2.这是系统错误吗?
旋转屏幕后如何恢复对话框等?例如,弹出一个alertDialog来告诉用户一些信息.然后用户将屏幕旋转到另一个方向.如何恢复alertDialog?任何人都可以指导我这样做吗?谢谢!
稍后附上:
我查看了android源代码并找到了这些东西:
对话框存储在mManagedDialogs,相关信息是:
mManagedDialogs = new SparseArray<ManagedDialog>();
Run Code Online (Sandbox Code Playgroud)
onSaveInstanceState 有关:
final void performSaveInstanceState(Bundle outState) {
onSaveInstanceState(outState);
saveManagedDialogs(outState);
}
Run Code Online (Sandbox Code Playgroud)
在saveManagedDialogs,它有一些关系mManagedDialogs.
onRestoreInstanceState 有关:
final void performRestoreInstanceState(Bundle savedInstanceState) {
onRestoreInstanceState(savedInstanceState);
restoreManagedDialogs(savedInstanceState);
}
Run Code Online (Sandbox Code Playgroud)
在restoreManagedDialogs,它有一些关系mManagedDialogs.
如您所见,对于高级功能,您必须自己执行保存和恢复工作.当你有吨定制的对话框时,它可能是一个夜晚的母马.我没有尝试过复杂的对话框(输入EdiText,listView,比如说).这样,我想警告用户:在对话框中输入信息时不要旋转屏幕...或者,在显示对话框时动态锁定旋转.
感谢所有回答我的人.希望我的信息对你也有帮助.
我有一个很长的文本和固定大小的textView.如何逐页显示文本?用户将以这种方式与程序交互:他向左或向右滑动以转到下一页或上一页.
目前,我创建了一个PageManager来完成这项工作.但它非常有限.处理文本的核心代码是:
while (true) {
newLineIndex = TextUtils.indexOf(content, '\n', processIndex);
if (newLineIndex == -1) {// till the end of content
charCount = paint.breakText(content, processIndex, content.length(), false, leftLines * lineWidth, width);
} else {
charCount = paint.breakText(content, processIndex, ++newLineIndex, false, leftLines * lineWidth, width);
}
leftLines = (int) ((leftLines * lineWidth - width[0]) / lineWidth);
processIndex += charCount;
if (leftLines < 1 || processIndex >= content.length()) {
page = new Page();
page.endIndex = processIndex;
page.startIndex = pageBaseLine;
page.content = content.subSequence(page.startIndex, page.endIndex); …Run Code Online (Sandbox Code Playgroud) 我的应用程序需要打开图库并选择要裁剪的图像.我将目标大小设置为值(87%*screenWide).现在,出现了问题.在大屏幕设备中,图库无法返回裁剪后的图像,日志显示"!!! FAILED BINDER TRANSACTION !!!".在大多数设备中,没关系.
任何人都可以帮我吗?谢谢!
我使用Intent.ACTION_GET_CONTENT来裁剪,并设置outputX,outputY等.裁剪图像的例行程序.