目前,我用下列方法装上灯塔,装上正确的形状:
context.packageManager.getApplicationIcon(packageName)
但是,我看一看根据用户图象(Square、Teardrop、Squircle等)的偏好对我评估中的一成不变,我很想知道,是否有办法确定用户的公式偏好在方案上。
目前,我用下列方法装上灯塔,装上正确的形状:
context.packageManager.getApplicationIcon(packageName)
但是,我看一看根据用户图象(Square、Teardrop、Squircle等)的偏好对我评估中的一成不变,我很想知道,是否有办法确定用户的公式偏好在方案上。
我认为,你应当使用。 他们为你 all。
中文14的系统校准名称为iconloader
(定位于/framework/libs/systemui/iconloaderlib
) 能够帮助您获得成形的icon(与系统缺省形成的形式,在com.android.internal.R.string.config_icon_mask<>/code>中界定,而不是由第三方发射器确定)。
尝试:
1. 首先包括这一平衡。 在此,我将使用安康。 bp 为例:
android_app {
name: "YourAppName",
//...
srcs: [
"src/**/*.java"
],
libs: [
//...
],
static_libs: [
"androidx.recyclerview_recyclerview",
"androidx-constraintlayout_constraintlayout",
"iconloader", // add this lib
],
}
2.sample code to get shaped app icon:
PackageManager pm = mContext.getPackageManager();
List<PackageInfo> installAppsList = pm.getInstalledPackages(0);
for(PackageInfo packageInfo : installAppsList) {
Drawable appIcon = packageInfo.applicationInfo.loadUnbadgedIcon(pm);
Bitmap iconBitmap = drawableToBitmap(appIcon);
try (IconFactory iconFactory = IconFactory.obtain(mContext)) {
UserHandle appUser =
UserHandle.getUserHandleForUid(packageInfo.applicationInfo.uid);
iconBitmap = iconFactory
.createShapedIconBitmap(iconBitmap, new IconOptions().setUser(appUser))
.icon;
appIcon = new BitmapDrawable(mContext.getResources(), iconBitmap);
iconFactory.recycle();
}
}
缩略语 http://www.un.org/Depts/DGACM/index_french.htm 方法是指。 如何将可图转化为比图?
public Bitmap drawableToBitmap(Drawable drawable) {
if (drawable instanceof BitmapDrawable) {
return ((BitmapDrawable)drawable).getBitmap();
}
int width = drawable.getIntrinsicWidth();
width = width > 0 ? width : 1;
int height = drawable.getIntrinsicHeight();
height = height > 0 ? height : 1;
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
drawable.draw(canvas);
return bitmap;
}
如果由RRO(接下com.android.internal.R.string.config_icon_mask
)对icon形成变化,则该守则仍然有效。
I m relatively new to Android development. I m developing an app with a ListView. I ve followed the info in #1338475 and have my app recognizing the fling gesture, but after the gesture is complete, ...
I m converting my code from using Handler to AsyncTask. The latter is great at what it does - asynchronous updates and handling of results in the main UI thread. What s unclear to me is how to handle ...
I want to be able to download a file with a particular extension from the net, and have it passed to my application to deal with it, but I haven t been able to figure out the intent filter. The ...
I am quite impressed by the workflow I follow when developing Android applications: Define a layout in an xml file and then write all the code in a code-behind style. Is there an equivalent style for ...
To draw landscapes, backgrounds with patterns etc, we used TiledLayer in J2ME. Is there an android counterpart for that. Does android provide an option to set such tiled patterns in the layout XML?
When following the Android Open Source Project instructions on installing repo for use with Git, after running the repo init command, I run into this error: /c/Users/Andrew Rabon/bin/repo: line ...
I read in the Android documentation that by setting my Activity s launchMode property to singleTop OR by adding the FLAG_ACTIVITY_SINGLE_TOP flag to my Intent, that calling startActivity(intent) would ...
I have pretty good skills in PHP , Mysql and Javascript for a junior developer. If I wanted to try my hand as Android Development do you think I might find it tough ? Also what new languages would I ...