zoukankan      html  css  js  c++  java
  • Android——Android Studio的一些小技巧(转)

    ndroid课程---Android Studio的一些小技巧

     

    APK瘦身

    在Android Studio中我们可以开启混淆,和自动删除没有Resources文件,来达到给APP瘦身的目的,这对于一些维护很久的老项目比较有用,
    里面有很多无效的Resource, 删除后生成的APK会小很多

    我们只需要在项目的build.gradle中加入

    android {
        buildTypes {
            release {
                minifyEnabled true
                shrinkResources true
            }
        }
    }

    minifyEnabled 是开启混淆
    shrinkResources 删除无效的Resource
    shrinkResources依赖于minifyEnabled,必须和minifyEnabled一起用。

    多语言编辑器

    我们在Android Studio打开一个String.xml文件,IDE会提示你使用多语言编辑器,这个真是个好东西,我们可以在这里把所有语言的字符串一并填上,还可以以红色标示哪些还没有翻译的。

    Selector自动生成器

    这个插件需要安装,我们可以在Preferences→Plugins→Browse repositories 搜索SelectorChapek安装

    1) 在资源文件目录点击右键,比如选择’drawable-xhdpi’

    2) 选择’Generate Android Selectors’

    3) 所有的selectors会自动生成到’drawable’文件夹

    插件地址:SelectorChapek for Android

    Logcat颜色自定义

    Android Studio里Logcat对于不同级别,默认基本上都是灰色,
    我们可以在设置里对Logcat的颜色进行自定义

     
    分类: Android
  • 相关阅读:
    Javascript
    CSS3新增特性HTML标签类型
    HTML5新增的标签
    prototype __proto__ Function
    oninput
    extend
    hasOwnProperty()
    this prototype constructor
    Array类型判断
    指针
  • 原文地址:https://www.cnblogs.com/Chenshuai7/p/5290081.html
Copyright © 2011-2022 走看看