一、欢迎窗口下(图一),Configure | Setting(敲黑板,划重点):

1.修改程序字体{
File | Settings | Appearance & Behavior | Appearance
-> Override default font by = Microsoft YaHei UI 12
}

2.启用内存信息显示{
File | Settings | Appearance & Behavior | Appearance
-> Show memory indicator = true
}

3.禁止启动时默认打开最近项目{
File | Settings | Appearance & Behavior | System Settings
-> Reopen last project on startup = false
}

4.修改文件编码格式{
File | Settings | Editor | File Encodings
-> Global Encoding:UTF-8
-> Project Encoding:UTF-8
-> Default encoding for properties files:UTF-8
-> Transparent native-to-ascii conversion = true
}

5.安装Material Theme UI{
File | Settings | Plugins
-> Browse Repositories
-> 搜索 Material Theme UI 安装
-> 依照提示重启IDEA
}

6.修改主题{
File | Settings | Editor | Color Scheme
-> 选择Material Deep Ocean
}

7.修改相应主题的编辑窗口字体{
File | Settings | Editor | Color Scheme | Color Scheme Font
-> Font:Fira Code
-> Show only monospaced fonts = false
-> Size:14
-> Line spacing:1.2
-> Fallback font:None
-> Enable font ligatures = true
}

8.修改相应主题的日志窗口字体{
File | Settings | Editor | Color Scheme | Console Font
-> Font:Consolas
-> Size:12
-> Line spacing:1.0
-> Fallback font:None
-> Enable font ligatures = false
}

9.安装Sexy Editor{
File | Settings | Plugins
-> Browse Repositories
-> 搜索 Sexy Editor 安装
-> 依照提示重启IDEA
}

10.设置编辑窗口背景{
File | Settings | Other Settings | SexyEditor
-> Position:Middle-Left
-> Offset:0
-> Fixed Position = true
-> Opacity:30
-> ADD IMAGE自定义背景
}

11.安装Translation{
File | Settings | Plugins
-> Browse Repositories
-> 搜索 Translation 安装
-> 依照提示重启IDEA
File | Settings | Other Settings | Translation
-> 覆盖默认字体 = true
-> 主要字体:Microsoft YaHei UI
-> 音标字体:Consolas

-> 不需要多余设置,记住三个快捷键
Ctrl+Shift+O:打开翻译对话框
Ctrl+Shift+Y:翻译选中位置的文字
Ctrl+Shift+X:翻译选中位置的文字并替换
}

12.修改快捷键{
File | Settings | Keymap
-> 备份当前方案
溢出菜单:Duplicate
-> 修改代码完成提示的快捷键
-> Main menu
-> Code
-> Completion
-> Basic,清除原本的快捷键(与Windows禁用输入法快捷键冲突),使用Alt+/(Eclipse的习惯)
}

13.优化代码格式(Ctrl+Alt+L使用){
File | Settings | Editor | Code Style | Java | Wrapping and Braces
-> Method declaration parameters = Wrap if long
Align when multiline = true
-> Method call arguments = Wrap if long
Align when multiline = true
-> Chained method calls = Wrap always
Align when multiline = true

File | Settings | Editor | Code Style | XML | Other
-> Wrap attributes = Wrap if long
Wrap text = true
}

14.注释//紧贴代码(Ctrl+/){
File | Settings | Editor | Code Style | Java | Code Generation
-> Block comment at first column = false
}

15.文档注释模板(自动添加){
File | Settings | Editor | File and Code Templates
-> Files
-> Class
在#parse("File Header.java")末尾处换行添加以下内容:

/**
 * @作者: ${USER}
 * @日期: ${DATE} ${TIME}
 * @版本: 1.0
 * @描述: //${Description}
 * 1.0: Initial Commit
 */

-> Interface
同上

-> Kotlin Class
同上

-> Kotlin Interface
同上
}

16.文档注释模板(手动添加){
File | Settings | Editor | Live Templates
-> Add(+号) - Template Group - 自定义,如Header Comment
-> Add(+号) - LiveTemplate - 自定义,如head
-> Abbreviation:head
-> Description:文件头注释
-> Template text:

/**
 * @作者: $user$
 * @日期: $date$ $time$
 * @版本: 1.0
 * @描述: $description$
 * 1.0: Initial Commit
 */

-> Edit Variables
Name        Expression        Skip if defined
user        user()            true
date        date()            true
time        time()            true
description                       
}

17.启用自动导包{
File | Settings | Editor | General | Auto Import
-> Add unambiguous imports on the fly = true
}

18.设置代理(不推荐,与16.设置国内镜像二选一。吐槽一下,网上众说纷纭,林檀改了N+1遍){
IDEA的代理分为两部分,程序自身代理设置和构建工具代理设置,这也是为什么明明程序设置了代理,但Gradle依然Sync失败的原因。

(1)程序自身配置
File | Settings | Appearance & Behavior | System Settings | HTTP Proxy
-> Manual proxy configuration = true
-> HTTP = true
-> Host:127.0.0.1
-> Port:1080
-> No proxy for:dl.google.com,translate.google.cn,plugins.jetbrains.com
(最后点击Check Connection,输入http://www.google.com测试)


(2)构建工具配置(Gradle代理,Maven代理)
Gradle全局代理:
-> C:\Users\XXX\.gradle目录下,新建gradle.properties文件,
PlanA,编辑并添加内容(注意,没有HTTPS,只要HTTP):
systemProp.http.proxyHost=127.0.0.1
systemProp.http.proxyPort=1080
systemProp.http.nonProxyHosts=dl.google.com,translate.google.cn,plugins.jetbrains.com

PlanB(2019.03.07测试失效),编辑并添加内容:
org.gradle.jvmargs=-DsocksProxyHost=127.0.0.1 -DsocksProxyPort=1080

Maven全局代理:
-> (安装根路径)\plugins\maven\lib\maven3\conf目录下,
拷贝settings.xml,粘贴到C:\Users\XXX\.m2目录中,
编辑内容,并查找:
<proxies>
  ………
</proxies>
在其中添加:
    <proxy>
      <id>ss</id>
      <active>true</active>
      <protocol>http</protocol>
      <host>127.0.0.1</host>
      <port>1080</port>
      <nonProxyHosts>127.0.0.1</nonProxyHosts>
}

19.设置国内镜像(推荐){
(1)程序自身配置(仅AS,IntelliJ无需配置)
File | Settings | Appearance & Behavior | System Settings | Android SDK
-> Force https://... sources to be fetched using http://... = true

File | Settings | Build, Execution, Deployment | Build Tools | Gradle | Android Studio
-> Enable embedded Maven repository = true

(2)构建工具配置
Gradle全局镜像:
-> C:\Users\XXX\.gradle目录下,新建init.gradle文件,编辑并添加内容:
allprojects{
    repositories {
    
        google()
        
        def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
        def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
        all { ArtifactRepository repo ->
            if(repo instanceof MavenArtifactRepository){
                def url = repo.url.toString()
                if (url.startsWith('https://repo1.maven.org/maven2')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                    remove repo
                }
                if (url.startsWith('https://jcenter.bintray.com/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                    remove repo
                }
            }
        }
        maven { url ALIYUN_REPOSITORY_URL }
        maven { url ALIYUN_JCENTER_URL }
    }
}

(2)Maven全局镜像:
-> (安装根路径)\plugins\maven\lib\maven3\conf目录下,
拷贝settings.xml,粘贴到C:\Users\XXX\.m2目录中,
编辑内容,并查找:
<mirrors>
  ………
</mirrors>
在其中添加:
<mirror>
  <id>alimaven</id>
  <name>aliyun maven</name> 
  <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
  <mirrorOf>central</mirrorOf>
</mirror>

二、欢迎窗口下(图一),Configure | Project Default | Project Structure(继续敲):

1.设置自定义JDK位置{
-> Project
-> 选择本机JDK路径
}

0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。