Is there a way to set the textStyle attribute of a TextView programmatically? There doesn\'t appear to be a setTextStyle() method.
I´ve resolved it with two simple methods.
Follow the explanation.
My existing style declaration:
My Android Java code:
TextView locationName = new TextView(getSupportActivity());
locationName.setId(IdGenerator.generateViewId());
locationName.setText(location.getName());
locationName.setLayoutParams(super.centerHorizontal());
locationName.setTextSize(24f);
locationName.setPadding(0, 0, 0, 15);
locationName.setTextColor(getResources().getColor(R.color.Church_Grey));
locationName.setShadowLayer(3, 1, 1, getResources().getColor(R.color.Shadow_Church));
Regards.