android设置TextView中drawableTop图片大小

在开发中我们经常用到TextView这个控件,很多时候我们需要文字和图片一起出现 ,那我们会优先使用TextView配合drawableTop,但会发现图片太大,导致不美观,这个时候就需要在代码中设置了。

在onCreate方法中

    TextView mText = (TextView) get(R.id.texts);
    Drawable drawable1=getResources().getDrawable(R.drawable.start_false);
    drawable1.setBounds(0,0,80,80);
    mText .setCompoundDrawables(null,drawable1,null,null);
    
    OK完美实现! 

你可能感兴趣的:(android设置TextView中drawableTop图片大小)