int除法
int除以int一定永远是int,要返回float,必须要用一个数是float
gradle support包冲突
自己写库时 对于support包不要compile,而要provided,确保依赖不传递
查看dependency中的依赖:
Gradle View只有在as3.0以下有用.
可以命令行:
./gradlew :app:dependencies --configuration compile
如果报错: 找不到或无法加载主类 org.gradle.wrapper.GradleWrapperMain,拷一份gradlewrapper过来即可.去除有依赖冲突的:
compile ("com.afollestad.material-dialogs:core:0.9.5.0") {
exclude group: 'com.android.support'
}
或者内部去除特定module
exclude group: 'com.android.support', module: 'support-vector-drawable'
从app目录中解析bitmap的坑
从drawable和raw下解析都会有放大或缩小,从assert下解析才能读原图大小.
bgimg0 = getImageFromAssetsFile("Cat_Blink/cat_blink0000.png");
*
* 从Assets中读取图片
*/
private Bitmap getImageFromAssetsFile(String fileName)
{
Bitmap image = null;
AssetManager am = getResources().getAssets();
try
{
InputStream is = am.open(fileName);
image = BitmapFactory.decodeStream(is);
is.close();
}
catch (IOException e)
{
e.printStackTrace();
}
return image;
}