Skip to content

InsetDrawable becoming weirdly small after Android 14 march (or was it april?) update #17

@LucasGGamerM

Description

@LucasGGamerM

Here we have the following screenshot, which showcases this piece of code:

public static void insetPopupMenuIcon(MenuItem item, ColorStateList iconTint, int addWidth) {
		Drawable icon=item.getIcon().mutate();
		if(Build.VERSION.SDK_INT>=26) item.setIconTintList(iconTint);
		else icon.setTintList(iconTint);
		int pad=V.dp(8);
		boolean rtl=icon.getLayoutDirection()==View.LAYOUT_DIRECTION_RTL;
		icon=new InsetDrawable(icon, rtl ? pad+addWidth : pad, 0, rtl ? pad : addWidth+pad, 0);
		item.setIcon(icon);
 		SpannableStringBuilder ssb = new SpannableStringBuilder(item.getTitle());
		item.setTitle(ssb);
	}

Captura de tela de 2024-04-19 15-01-17

And this one showcases the same piece of code, but without the InsetDrawable:

public static void insetPopupMenuIcon(MenuItem item, ColorStateList iconTint, int addWidth) {
		Drawable icon=item.getIcon().mutate();
		if(Build.VERSION.SDK_INT>=26) item.setIconTintList(iconTint);
		else icon.setTintList(iconTint);
		int pad=V.dp(8);
		boolean rtl=icon.getLayoutDirection()==View.LAYOUT_DIRECTION_RTL;
		// icon=new InsetDrawable(icon, rtl ? pad+addWidth : pad, 0, rtl ? pad : addWidth+pad, 0);
		item.setIcon(icon);
 		SpannableStringBuilder ssb = new SpannableStringBuilder(item.getTitle());
		item.setTitle(ssb);
	}

Captura de tela de 2024-04-19 15-01-37

And here is the same code as the first piece, but instead being on an earlier build of Android 14:

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions