XML代码

android:drawableLeft="@drawable/"android:drawableTop="@drawable/"android:drawableRight="@drawable/"android:drawableBottom="@drawable/"

Java代码

Drawable img=getResources().getDrawable(R.drawable.img);img.setBounds(0, 0, img.getMinimumWidth(), img.getMinimumHeight());  view.setCompoundDrawables(null, null,img,null);
最后一行代码设置左上右下



更多相关文章

  1. Android(安卓)自定义dialog
  2. android软键盘右下角按键设置
  3. 如何用android:layout_weight弄个满意的比例
  4. 在程序中设置android:gravity 和 android:layout_Gravity属性
  5. Android(安卓)Studio 系列(四)Version Control II Annotate
  6. 通过在xml布局文件中设置android:onClick=""来实现组件单击事件
  7. android 设置系统自带字体
  8. layout布局属性
  9. Android(安卓)AS代码警告 (个人笔记)

随机推荐

  1. Android studio3.6的JNI教程之helloworld
  2. android 使用TextView/EditText应该注意
  3. TextView字间距和行间距设置
  4. 使用AIDL实现Android的跨进程通信
  5. android checkbox,radiobox style自定义
  6. Phone拨号调起InCallUi流程(Phone 9.0 )(P
  7. 基于Android(安卓)XML解析与保存的实现
  8. Android Drawable Importer的使用
  9. Android中判断字符串中必须包含字母或者
  10. android browser 的几个小feature (四) k