https://blog.csdn.net/catoop/article/details/39959175 ...
根据业务的需要,要在代码中设置控件的drawableLeft,drawableRight,drawableTop,drawableBottom属性。 我们知道在xml中设置的方法为:android:drawableLeft drawable xxxxx 但是在代码中并没有相关的setDrawableLeft等方法。怎么办呢 别担心,api为我们提供了一个setCompoundDrawables l ...
2014-05-21 09:51 0 11483 推荐指数:
https://blog.csdn.net/catoop/article/details/39959175 ...
例子: Drawable drawable=getResources().getDrawable(R.drawable.xx); //获取图片 drawable.setBounds(left, top, right, bottom); //设置图片参数 ...
xml中的textView中设置android:drawableLeft: <TextView android:id="@+id/bookTitle" android:layout_width="match_parent ...
TextView的xml [html] view plain copy <TextView android:id ...
首先,我们在开发过程中,会经常使用到android:drawableLeft="@drawable/ic_launcher"这些类似的属性: 关于这些属性的意思,无非是在你的textView文本的上下左右处添加一个图片。比如下面这么一段代码: <TextView ...
效果图: 重要属性: textView.setCompoundDrawablePadding(4);//设置图片和text之间的间距 textView.setPadding(-5, 0, 0, 0);//设置总体的padding private ...
首先,我们在开发过程中,会经常使用到android:drawableLeft="@drawable/ic_launcher"这些类似的属性: 关于这些属性的意思,无非是在你的textView文本的上下左右处添加一个图片。比如下面这么一段代码 ...
Drawable drawable=getResources().getDrawable(R.drawable.xx); //获取图片 drawable.setBounds(left, top, right, bottom); //设置图片参数 ...