<img src="file:///android_res/drawable/image.png">
But,it is not working when using flavor with other package name On low api level(about 19)
private Bitmap createBitmap_ScriptIntrinsicBlur(Bitmap src, float r) {
//Radius range (0 < r <= 25)
if(r <= 0){
r = 0.1f;
}else if(r > 25){
r = 25.0f;
}
Bitmap bitmap = Bitmap.createBitmap(src.getWidth(), src.getHeight(),Bitmap.Config.ARGB_8888);
RenderScript renderScript = RenderScript.create(getActivity());
Allocation blurInput = Allocation.createFromBitmap(renderScript, src);
Allocation blurOutput = Allocation.createFromBitmap(renderScript, bitmap);
ScriptIntrinsicBlur blur = ScriptIntrinsicBlur.create(renderScript,Element.U8_4(renderScript));
blur.setInput(blurInput);
blur.setRadius(r);
blur.forEach(blurOutput);
blurOutput.copyTo(bitmap);
renderScript.destroy();
return bitmap;
}
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="match_parent"
android:layout_height="200dp"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="12sp"
app:autoSizeMaxTextSize="100sp"
app:autoSizeStepGranularity="2sp" />
</LinearLayout>
private String renameImgSrcAttr(String html){
Document document = Jsoup.parse(html);
Elements imageElements = document.select("img");
for (Element e : imageElements) {
String imgSrcValue = e.attr("src");
e.removeAttr("src");
e.attr("data-src",imgSrcValue);
}
return document.outerHtml();
}
nsdManager.discoverServices(SERVICE_TYPE, NsdManager.PROTOCOL_DNS_SD, discoveryListener)
if (action.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) {
String reason = intent.getStringExtra( "reason" );
if (reason != null) {
if( null != mOnHomeBtnPressListener ){
if( reason.equals( "homekey" ) ){
// 按Home按键
mOnHomeBtnPressListener.onHomeBtnPress( );
}else if( reason.equals( "recentapps" ) ){
// 长按Home按键
mOnHomeBtnPressListener.onHomeBtnLongPress( );
}
}
}
}
即监听Intent.ACTION_CLOSE_SYSTEM_DIALOGS