0

Hi have this in my XML file:

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal" >

            <ImageView
                android:id="@+id/picture_text"
                android:layout_width="32dp" 
                android:layout_height="32dp"
                android:layout_marginRight="10dp"
                android:src="@drawable/text"/>

            <TextView 
               android:id="@+id/textview_message"
               android:layout_width="wrap_content"
               android:layout_height="wrap_content"               
               android:text="@string/tap_message"
               android:onClick="GoToMessage"                
               android:clickable="true"
               style="@style/text_link"/>
        </LinearLayout>

Android lint complains with a warning that this should be combined in a textview compound. I can do that, but I don't understand how to set the width, height, and margin for the imageview...

Can anyone show me how to do this?

Thanks

omega
  • 40,311
  • 81
  • 251
  • 474
  • http://stackoverflow.com/questions/4502605/how-to-programatically-set-drawableleft-on-android-button/4502650#4502650 - Same can be sone with `TextView` – Varun Sep 06 '13 at 18:55

1 Answers1

1

It's recommending to add a drawable within the textview as follows:

<TextView
     android:id="@+id/title"
     android:drawableLeft="@yourDrawable"
     android:layout_width="wrap_content"
     android:layout_height="wrap_content"
     android:text="yourText">
            </TextView>

Hope this helps.

Regards!

Martin Cazares
  • 13,637
  • 10
  • 47
  • 54