android studio会立即删除我的副本&粘贴导入声明 [英] the android studio instantly remove my copy & paste import statement

查看:88
本文介绍了android studio会立即删除我的副本&粘贴导入声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个由android studio 0.8x设置的项目(空白活动),但是当我粘贴(ctrl + v)某些导入语句时,如下所示

i've a project (blank activity) set up by android studio 0.8x, but when i paste (ctrl + v) some import statement like the following

import android.app.Activity;
import android.content.res.Resources;
import android.graphics.drawable.TransitionDrawable;
import android.os.Bundle;
import android.widget.ImageView;

android studio将自动回滚(ctrl + z),并且仅保留默认的import语句,所以我现在不能使用任何自定义import语句,这是怎么回事?

the android studio will automatically rollback (ctrl + z) and only default import statement will stay, so i can't use any custom import statement now, what the matter is going on?

推荐答案

您可以在设置",编辑器",自动导入"中控制行为.这是即时优化导入"设置

You can control the behaviour in Settings, Editor, Auto-Import. It is the "optimize imports on the fly" setting

但是,我建议您开始编写代码,Android Studio将突出显示您尚未导入的类,然后您只需键入Alt + Enter即可添加必要的导入

However, I would recommend to start writing your code, Android Studio will highlight the classes you have not yet imported and then you can add the necessary imports by simply typing Alt+Enter

这篇关于android studio会立即删除我的副本&粘贴导入声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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