android TextView内嵌drawable

 <TextView
                           
                            android:layout_width="wrap_content"
                            android:layout_height="wrap_content"
                            android:layout_centerVertical="true"
                            android:layout_gravity="center_horizontal"
                            android:drawableLeft="@mipmap/like"
                            android:drawablePadding="@dimen/dp_5"
                            android:text="@string/love"
                            android:textColor="#333333"
                            android:textSize="@dimen/sp_12"
                            android:layout_toLeftOf="@+id/paly_videoinfo"
                            android:layout_marginRight="@dimen/dp_15"

                            />
                        
videoinfo_like.setText("已收藏");
Drawable drawable = getResources().getDrawable(R.mipmap.like_icon);
drawable.setBounds(0, 0, 30, 30);// 设置边界
videoinfo_like.setCompoundDrawables(drawable, null, null, null);
发布了154 篇原创文章 · 获赞 391 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/LucasXu01/article/details/100927194