I'm try to set `Toggle Drawable' to right of AppCompatRadioButton' text with
public class mRadioButton extends AppCompatRadioButton {
public mRadioButton(Context context) {
super(context);
init();
}
...
private void init() {
setButtonDrawable(null);
int padding = Constant.calculateDimen(getContext(), 20.0);
setPadding(padding, padding, padding, padding);
setGravity(Gravity.RIGHT);
setLayoutParams(new FrameLayout.LayoutParams(-1, -1));
int[] attrs = { android.R.attr.listChoiceIndicatorSingle };
TypedArray ta = getContext().getTheme().obtainStyledAttributes(attrs);
Drawable indicatorDrawable = ta.getDrawable(0);
setCompoundDrawables(null, null, indicatorDrawable, null);
ta.recycle();
}
}
But ultimately , no Toggle Drawable appears :
And if set comment setButtonDrawable(null);
add Toggle left of text :
And set setButtonDrawable(indicator);
appears Toggle Drawable both left an right of text:
What's going on , whats wrong and what to do?