Inspectopedia Help

Node can be replaced by a TextView with compound drawables

Node can be replaced by a TextView with compound drawables

A LinearLayout which contains an ImageView and a TextView can be more efficiently handled as a compound drawable (a single TextView, using the drawableTop, drawableLeft, drawableRight and/or drawableBottom attributes to draw one or more images adjacent to the text).

If the two widgets are offset from each other with margins, this can be replaced with a drawablePadding attribute.

There's a lint quickfix to perform this conversion in the Eclipse plugin.

Issue id: UseCompoundDrawables

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for Android 2023.3, Qodana for JVM 2023.3

Plugin:

Android, 2022.3.1 Beta 2

Last modified: 13 July 2023