int除法
int除以int一定永遠(yuǎn)是int,要返回float,必須要用一個(gè)數(shù)是float
gradle support包沖突
自己寫庫(kù)時(shí) 對(duì)于support包不要compile,而要provided,確保依賴不傳遞
查看dependency中的依賴:
Gradle View只有在as3.0以下有用.
可以命令行:
./gradlew :app:dependencies --configuration compile
如果報(bào)錯(cuò): 找不到或無法加載主類 org.gradle.wrapper.GradleWrapperMain,拷一份gradlewrapper過來即可.去除有依賴沖突的:
compile ("com.afollestad.material-dialogs:core:0.9.5.0") {
exclude group: 'com.android.support'
}
或者內(nèi)部去除特定module
exclude group: 'com.android.support', module: 'support-vector-drawable'
從app目錄中解析bitmap的坑
從drawable和raw下解析都會(huì)有放大或縮小,從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;
}