版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/liuxian13183/article/details/88225831
本文来自http://blog.csdn.net/liuxian13183/ ,引用必须注明出处!
工作中有太多的知识点,不需要死记硬背,但需要灵活运用。本篇主要将这些内容,记录下来,方便自己和他人查阅。
1、为TextView设置方位(上下左右)图片,并修改文字颜色
int friendResource = isOpenFriend ? R.mipmap.icon_open_friend_style : R.mipmap.icon_close_friend_style;
Drawable rightDrawable = getResources().getDrawable(friendResource);
rightDrawable.setBounds(0, 0, rightDrawable.getMinimumWidth(), rightDrawable.getMinimumHeight());
mFriendTv.setCompoundDrawables(null, rightDrawable, null, null);
int color = getResources().getColor(isOpenFriend ? R.color.color_ffff3652 : R.color.color_ffffffff);
mFriendTv.setTextColor(color);
2、为第三方sdk模块设置独立的资源库(res-umc),并让它成为系统认识的资源,即res文件夹再命名
sourceSets {
main {
res.srcDirs = ['src/main/res', 'src/main/res-umc']
}
}
3、开发xml文件时,如何在开发阶段显示属性,在正式版本隐蔽属性,那就用tools方法
tools:text="1"
更多:http://www.jcodecraeer.com/a/anzhuokaifa/androidkaifa/2015/0309/2567.html
4、release正式包,不能查看日志,在build文件release的渠道下,添加此行代码,可以在release包下打印log
debuggable true
5、查看apk信息
adb shell dumpsys package com.example.test
查看apk某项指标信息(例:versionCode)
adb shell dumpsys package com.example.test | findstr versionCode
如果觉得内容不够,可以查看另一篇 熟悉Android开发不得不知道的技巧