Shruti
Shruti

Reputation: 5591

Lint warning Android

This tag and its children can be replaced by one and a compound drawable

Issue: Checks whether the current node can be replaced by a TextView using compound drawables.

A LinearLayout which contains an ImageView and a TextView can be more efficiently handled as a compound drawable

I am getting this lint warning in one of my Layout.I am not getting what does it mean by Compound Layout.Please explain or provide any suitable links.

Upvotes: 1

Views: 1837

Answers (2)

repitch
repitch

Reputation: 1888

Sometimes image's styling is too complex, to use it just as compound drawable along with textView, so, the best decision here is to ignore that warning:

<LinearLayout
    ...
    tools:ignore="UseCompoundDrawables" />

Upvotes: 1

gwvatieri
gwvatieri

Reputation: 5183

You can replace your 'complex' layout with just one view:

<TextView
     android:id="@+id/textViewId"
     ...
     android:drawableLeft="@drawable/drawableName" />

Upvotes: 2

Related Questions