无法在 Android Studio 中编辑文件 [英] Can't Edit Files in Android Studio

查看:97
本文介绍了无法在 Android Studio 中编辑文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于某种未知原因,我无法在 Android Studio 中编辑文件.这包括 Java 和 XML 文件.

For some unknown reason, I can't edit files in Android Studio. This includes both Java and XML files.

当我启动 Android Studio (v1.2.2) 时,一切正常.但是,一段时间后,我失去了编辑文件内容的能力.这是我注意到的:

When I launch Android Studio (v1.2.2), everything is fine. However, after some time, I lose the ability to edit files content. Here is what I noticed:

  • 当我点击源代码中的任何一行时,这些行会突出显示,但没有显示插入符号.
  • 当我开始输入时,search for: 框开始出现在左侧面板(项目窗口)的顶部,它开始根据我输入的内容过滤项目文件!
  • 文件未锁定为只读.我查过了.
  • 重启 Android Studio 并没有永久解决它.一段时间后一切正常,然后问题再次出现.
  • 我确实检查了我的键盘,看看我是否有可能导致此问题的按键卡住.什么都没注意到.
  • 在项目窗口中,我注意到 MainActivity 文件名是灰色的(见下面的截图).我不确定这是因为我做了什么,还是因为 Android Studio 识别项目中的主要活动.
  • When I click on any line in the source code, the lines get highlighted but the caret indicator is not showing.
  • When I start typing, a search for: box starts appearing on the top of the left panel (Project window), and it starts filtering the project files according to what I type!
  • Files are not locked as Read-Only. I checked.
  • Restarting Android Studio did not resolve it permanently. Everything seems fine for some time, then the problem appears again.
  • I did check my keyboard to see if I have a stucked keystroke that might cause this problem. Didn't notice anything.
  • In the Project window, I noticed that MainActivity file name is in grey (See the screenshot below). I'm not sure if this is because of something I did, or if it is how Android Studio identifies the main Activity in the project.

推荐答案

这似乎是代码视图失去了对项目视图的关注.这就是为什么我无法编辑代码并出现搜索框的原因:因为焦点始终位于项目视图中.

This appears to be that the Code view loses focus to the Project view. That's why I can't edit the code and the search box appears: because The focus is with the Project view, permanently.

我找不到永久解决方案.然而,我偶然发现了一个比重启 Android Studio 更不烦人的解决方法:

I couldn't find a permanent solution. However, by accident, I found a workaround that is less annoying than restarting Android Studio:

当您失去对项目视图的关注时,单击代码视图最右侧(滚动条所在的位置).

When you lose focus to the Project view, click on the far right of the Code View, where the scrollbar exist.

我试图找出导致项目视图永久窃取焦点的原因,但我不能.在有人这样做之前,这将是公认的答案.

I tried to figure out what causes the Project View to steal the focus permanently but I couldn't. Until someone do, this will be the accepted answer.

这篇关于无法在 Android Studio 中编辑文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆