int dp40 = DensityUtil.dip2px(getActivity(), 40); //定义底部标签图片大小和位置 Drawable drawable_rbOrderAll = getResources().getDrawable(R.drawable.rb_order_all_selector); //当这个图片被绘制时,给他绑定一个矩形 ltrb规定这个矩形 drawable_rbOrderAll.setBounds(0, 0, dp40, dp40); //设置图片在文字的哪个方向 rbOrderAll.setCompoundDrawables(null, drawable_rbOrderAll, null, null); Drawable drawable_rbOrderComplete = getResources().getDrawable(R.drawable.rb_order_complete_selector); drawable_rbOrderComplete.setBounds(0, 0, dp40, dp40); rbOrderComplete.setCompoundDrawables(null, drawable_rbOrderComplete, null, null); Drawable drawable_rbOrderMicropayment = getResources().getDrawable(R.drawable.rb_order_micropayment_selector); drawable_rbOrderMicropayment.setBounds(0, 0, dp40, dp40); rbOrderMicropayment.setCompoundDrawables(null, drawable_rbOrderMicropayment, null, null); Drawable drawable_rbOrderCancel = getResources().getDrawable(R.drawable.rb_order_cancel_selector); drawable_rbOrderCancel.setBounds(0, 0, dp40, dp40); rbOrderCancel.setCompoundDrawables(null, drawable_rbOrderCancel, null, null); rbOrderAll.setChecked(true); rg_order.setOnCheckedChangeListener(this);
设置DrawablepaddingLeft
最新推荐文章于 2024-03-28 13:56:44 发布