Here is my style:
<style name="buttonQuestionStyle" parent="@style/Widget.AppCompat.Button.Colored">
<item name="android:layout_width">match_parent</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">16sp</item>
<item name="android:padding">25dp</item>
<item name="android:layout_margin">10dp</item>
<item name="android:background">@color/questionButton</item>
</style>
And here my code:
Button btn = new Button(getActivity());
btn.setText(ojb.getText());
if (Build.VERSION.SDK_INT < 23) {
btn.setTextAppearance(getActivity(), R.style.buttonQuestionStyle);
} else {
btn.setTextAppearance(R.style.buttonQuestionStyle);
}
In the app:
Programmatically button appears like this:
And via layout it worked. Appears like this:
Here is my code in the XML Layout:
<Button
android:text="Question"
style="@style/buttonQuestionStyle" />
So... I dont know why it happens, and how fix it.