I am trying to use R.layout.simple_list_item_multiple_choice with ListView. CheckedTextView is used in simple_list_item_multiple_choice.xml, but how can I make the checkbox
Looking at the source, it's just based on layout direction. Setting it to RTL works well enough for me.
android:layoutDirection="rtl"
Source:
private boolean isCheckMarkAtStart() {
final int gravity = Gravity.getAbsoluteGravity(mCheckMarkGravity, getLayoutDirection());
final int hgrav = gravity & Gravity.HORIZONTAL_GRAVITY_MASK;
return hgrav == Gravity.LEFT;
}
.
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
...
final boolean checkMarkAtStart = isCheckMarkAtStart();
final int width = getWidth();
final int top = y;
final int bottom = top + height;
final int left;
final int right;
if (checkMarkAtStart) {
left = mBasePadding;
right = left + mCheckMarkWidth;
} else {
right = width - mBasePadding;
left = right - mCheckMarkWidth;
}
...
}
}
}