Hi I need to Create a custom radio button class with two different picture for each state and RTL text. I made the button but i couldn't make text RTL for api 8 and upper . i would be happy if some one could help me
RadioGroup crdg = (RadioGroup) findViewById(R.id.radioGroup11);
make Radio button
rdbt1 = new RadioButton(new ContextThemeWrapper(
getApplicationContext(), R.style.styleName));
rdbt1.setButtonDrawable(android.R.color.transparent);
rdbt1.setText("for example(RTL text)");
add RadioButton to Radio Group
crdg.addView(rdbt1);
styleName is
<style name="styleName" parent="android:Widget.CompoundButton.RadioButton">
<item name="android:button">@null</item>
<item name="android:drawableRight">@drawable/rdb_question_selector</item>
</style>
You just have to set the gravity to
Gravity.END
So for example:This will tell Android to align the text to the "end" of the view respecting RTL languages.