See: Need pictures and text together
The previous practice was to use two controls to make a
<LinearLayout> <imageview/> <textview/></linearlayout>
Today read People's source code, found that the original TextView can be achieved:
<TextView Android:id= "@+id/btn_middle"style= "@style/style_topbar_textview_shadow"Android:layout_width= "Wrap_content"Android:layout_height= "Wrap_content"android:layout_gravity= "Center" android:drawableleft= "@drawable/actionbar_icon" android:drawablepadding= "4.0d IP "android:ellipsize= "End"android:gravity= "Center_vertical"Android:singleline= "true"Android:text= "@string/app_name"Android:textcolor= "#ffffffff"android:textsize= "@dimen/size_big"android:visibility= "Visible"/>
The bold code is the key:
android:drawableleft= "@drawable/actionbar_icon"-This picture is on the left side of the text, which of course allows it to be on the right side of the text, and the right and left can be set simultaneously
Android:drawablepadding= "4.0dip"-distance between pictures and text
Android TextView (simultaneous display of pictures + text)