Java 为什么我的键盘在 Eclipse 中乱七八糟?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2806173/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 13:02:33  来源:igfitidea点击:

Why is my keyboard messed up in Eclipse?

javaeclipse

提问by Xi Zhang

I am trying to type in a pair of angle brackets in Eclipse, like "<>". However it shows up as a single quotation and a dot, like "'.". I tried a couple of times and found out that the angle bracket is actually located at back-slash's position.

我试图在 Eclipse 中输入一对尖括号,例如“<>”。但是它显示为单引号和一个点,如“'.”。我尝试了几次,发现尖括号实际上位于反斜杠的位置。

Why is this happening? How can I change it back?

为什么会这样?我怎样才能把它改回来?

Thanks in advance.

提前致谢。

Xi

采纳答案by Jesper

I think this has to do with an annoying feature of Windows - I've had something similar for a long time in different programs (not just Eclipse).

我认为这与 Windows 的一个恼人的特性有关 - 我在不同的程序(不仅仅是 Eclipse)中已经有很长一段时间了。

If you have a non-English version of Windows, you probably have different keyboard layouts installed (for example, I have a Dutch and a US English layout installed by default). The key combination Alt+ Shiftswitches between keyboard layouts. It's very annoying and it's a really strange feature - as if the keys on someone's keyboard would suddenly change?!

如果您使用的是非英语版本的 Windows,则您可能安装了不同的键盘布局(例如,我默认安装了荷兰语和美国英语布局)。组合键Alt+Shift在键盘布局之间切换。这很烦人,而且是一个非常奇怪的功能——好像某人键盘上的键会突然改变?!

You can go into Control Panel, Keyboard Settings and remove the layouts that you don't want to use. (I removed the Dutch layout so there's only US English left), so that you can't switch to the wrong layout by accident again. Or you can go to the Advanced Key Settings in Keyboard Setting and turn off the key combination.

您可以进入控制面板、键盘设置并删除您不想使用的布局。(我去掉了荷兰语版式所以只剩下美式英语了),这样你就不会再不小心切换到错误的版式了。或者您可以进入键盘设置中的高级按键设置并关闭组合键。

回答by Mitch Dempsey

... Maybe you have your keyboard set for a different Locale(country)?

...也许您的键盘设置为不同的语言环境(国家/地区)?

Also, you would probably be better asking this on SuperUser

另外,您可能最好在 SuperUser 上问这个问题

回答by Oleg Ryaboy

Hit Alt+ Shift. If you don't want to spend time removing keyboard layouts like Jesper suggested, just hit Alt+ Shiftuntil you get the layout you need. It usually doesn't take more than a couple times. :)

点击Alt+ Shift。如果您不想像 Jesper 建议的那样花时间删除键盘布局,只需点击Alt+Shift直到您获得所需的布局。通常不会超过几次。:)

回答by julioA

In windows 7 the language bar uses the LEFT ALT+ SHIFTkey sequence to change languages, so you can quickly change the language say to Spanish when writing a mail.

在 Windows 7 中,语言栏使用LEFT ALT+SHIFT键序列来更改语言,因此您可以在编写邮件时快速将语言更改为西班牙语。

This sequence conflicts with many Eclipse shortcuts that use ALT+ SHIFT, like rename!

此序列与许多使用ALT+ 的Eclipse 快捷方式冲突SHIFT,例如重命名!

You can remove the OS's setting by control panel > keyboards and languages > change keyboards > advanced key settings.

您可以通过控制面板 > 键盘和语言 > 更改键盘 > 高级键设置来删除操作系统的设置。

Julio

胡里奥

回答by Henrik Tóth

Keyboard handling of Eclipse is not perfect indeed: it confuses ctrl-alt with "altgr"!

Eclipse 的键盘处理确实并不完美:它会将 ctrl-alt 与“altgr”混淆!

So for example with Hungarian keyboard layout you cannot enter character '&', as it requires pressing altgr-C- but ctrl-alt-Cwas set to "SVN commit" by default... (of course no problem in un-binding that combination in Eclipe, but it was not straightforward that ctr-alt conflicts with altgr, so what to look for)

因此,例如,对于匈牙利键盘布局,您无法输入字符“&”,因为它需要按altgr- C- 但是ctrl- alt-C默认设置为“SVN commit”...(当然,在 Eclipe 中取消绑定该组合没有问题,但 ctr-alt 与 altgr 冲突并不简单,所以要寻找什么)

回答by Luis Aguiar

with me, the strange thing is outside of eclipse (i use the ADT package), everything is ok. And restarting workspace, fixes the problem

对我来说,奇怪的是在 eclipse 之外(我使用 ADT 包),一切正常。并重新启动工作区,解决问题

this happens when i type any expression that might not be valid, like when i try to write

当我键入任何可能无效的表达式时会发生这种情况,例如当我尝试编写时

taskNameEditText = (EditText)findVie

taskNameEditText = (EditText)findVie

of course, i want to write

当然,我想写

taskNameEditText = (EditText)findViewById(R.id.task_name);

taskNameEditText = (EditText)findViewById(R.id.task_name);

but after the first snippet, it changes the keyboard. And the code completion stops working too. So far the only working solutions i found where: 1 - restarting eclipse, 2 - start using IntelliJ

但在第一个片段之后,它改变了键盘。代码完成也停止工作。到目前为止,我找到的唯一可行的解​​决方案是:1 - 重新启动 eclipse,2 - 开始使用 IntelliJ

changing the key bindings wont work, just because i already have those unset. Also, "Alt + Shift" wont work, because this is not a windows (i use 7, 64 bits) problem

更改键绑定不起作用,只是因为我已经有那些未设置。此外,“Alt + Shift”不起作用,因为这不是 Windows(我使用 7、64 位)问题

回答by Luis Aguiar

Actually i think this must be something with Java SDK, because im having the same problem with IntelliJ. For example, in

实际上我认为这一定是 Java SDK 的问题,因为我在 IntelliJ 上遇到了同样的问题。例如,在

public class MainActivity extends Activity {
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        ImageView iv
    }
}

when i try to complete this snippet, with

当我尝试完成这个片段时,

ImageView iv = (ImageView) findViewById(R.id.iv_imagem);

after "iv" the character set in my keyboard is screwed, and instead of a QWERTY keyboard (i have portuguese language defined, and dont have other keyboards in control pannel) i have a AZERTY

在“iv”之后,我的键盘中的字符集被搞砸了,而不是 QWERTY 键盘(我定义了葡萄牙语,并且控制面板中没有其他键盘)我有一个 AZERTY

in windows, other applications are is still normal

在windows下,其他应用都还正常

回答by Elshan

I Am Doing This Via Windows Control Panel.

我正在通过 Windows 控制面板执行此操作。

First time when changing font.I am restart Eclipse.(No solution than that to save my time) and then do this. enter image description here

第一次更改字体时。我重新启动 Eclipse。(没有比这更节省时间的解决方案)然后执行此操作。 在此处输入图片说明

回答by Martijn Dirkse

I had the same problem. I was editing Java code in Eclipse and the keyboard layout suddenly changed. On my windows taskbar I have a keyboard icon and I used it to change the keyboard layout between United States-International and Dutch. That did not solve my problem. My problem was solved when I had restarted Eclipse.

我有同样的问题。我在 Eclipse 中编辑 Java 代码时,键盘布局突然发生了变化。在我的 Windows 任务栏上,我有一个键盘图标,我用它来更改美国-国际和荷兰语之间的键盘布局。那并没有解决我的问题。当我重新启动 Eclipse 时,我的问题解决了。

回答by Nag from Venkusa Technologies

I guess this probably happens if your script in Eclipse uses Robot class or any statements that use the combination of the keys, ALT+SHIFTOR CTRL+SHIFT. These combinations mess up with the functions of other keys after your script execution is completed or if it is stopped in between.

我想这可能发生在 Eclipse 中的脚本使用 Robot 类或任何使用键组合的语句时,ALT+ SHIFTOR CTRL+ SHIFT。在您的脚本执行完成后或中间停止时,这些组合会干扰其他键的功能。

If you want to confirm if any of these combination is really messing up with your keys, then in your testng.xmlfile, just mouseover on any class name and it will be highlighted and underlined automatically, even though we have not pressed ALTnor SHIFTat this moment. It means that these keys are not released yet even though your script might have released them.

如果您想确认这些组合中的任何一个是否真的弄乱了您的键,那么在您的testng.xml文件中,只需将鼠标悬停在任何类名上,它就会自动突出显示并加下划线,即使我们没有按下ALTSHIFT在此片刻。这意味着即使您的脚本可能已经释放了这些键,它们也尚未释放。

If you face this problem, then the control being in Eclipse, press CTRL+SHIFTand press ALT+SHIFT, and this resolves the above problem. Now, the keys in your keyboard work as usual.

如果您遇到此问题,则控件在 Eclipse 中,按CTRL+SHIFT并按ALT+SHIFT,这解决了上述问题。现在,键盘上的按键可以照常工作。