In my code, I add input elements like radioButtons, checkboxes etc to my Layout programmatically. The problem is, that the style of those elements is not the default style that you would get, when you would add let's say a radioButton via xml. (It looks really white and almost see-through on a white application background. A bit like it is transparent) Also, the EditText elements I'm adding have the same style and if you type something in them, the text is too big and overlaps the text line a bit. So I guess it all comes down to somehow giving those elements their default style, like they look when defined via xml.
A sample of my code looks like this:
RadioGroup radioGroup = new RadioGroup(mContext);
radioGroup.setLayoutParams(fullWidthWrapHeight);
for (int i = 0; i < arg0.getOptions().size(); i++){
RadioButton radioButton = new RadioButton(mContext, null);
radioButton.setPadding(padding16dp , padding8dp, padding16dp, padding8dp);
radioButton.setText(arg0.getOptions().get(i).getText());
radioButton.setLayoutParams(wrapBoth);
radioButton.setGravity(Gravity.CENTER_HORIZONTAL);
radioButton.setTextAppearance(mContext, R.style.Default_Text);
radioGroup.addView(radioButton);
}
My target API lvl is 21 (Lollipop)