大佬教程收集整理的这篇文章主要介绍了Android:带有两个图像的按钮|对准,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
Drawable icon = context.getresources().getDrawable(iconresourcEID); button.setCompoundDrawablesWithIntrinsicBounds(icon,null,@R_874_6633@
现在,我想在右上角有另一个图像(图标),请看下图:
Drawable icon = context.getresources().getDrawable(iconresourcEID); Drawable icon2 = context.getresources().getDrawable(iconresourceid2); button.setCompoundDrawablesWithIntrinsicBounds(icon,icon2,@R_874_6633@
而且,我得到以下结果:
任何人都可以告诉我,我怎样才能将它与右上角对齐?
Button button = new Button(this); Drawable icon = context.getresources().getDrawable(iconresourcEID); button.setCompoundDrawablesWithIntrinsicBounds(icon,@R_874_6633@ button.setText("Test"); if (hasNewupdates()) { button.setBACkgroundresource(R.drawable.btn_BACkground_with_icon); } else { button.setBACkgroundresource(R.drawable.btn_BACkground); }
这就是btn_BACkground_with_icon的样子
<?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://scheR_23_11845@as.android.com/apk/res/android"> <item android:drawable="@drawable/btn_BACkground"/> <item android:gravity="right" android:bottom="72dp" android:drawable="@drawable/ico_info"/> </layer-list>
以上是大佬教程为你收集整理的Android:带有两个图像的按钮|对准全部内容,希望文章能够帮你解决Android:带有两个图像的按钮|对准所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。