How to center text & images in a CompoundDrawable?
android
Solution
Add `android:gravity="center"` to your TextView.
Problem
A CompoundDrawable is a TextView with an image and a text right? So if it's a combination of the two, how can you put the text in the center with respect to the image? Or how can you put the image in the center with respect to the text if the text is a bit smaller compared to the image? Or what if the image is smaller than the text? How could I cover these scenarios using `XML`? Here is an example of a CompoundDrawable: ``` <TextView android:id="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content" android:drawableTop="@drawable/image" android:text="@string/text" /> ```