I've define a Style for the button
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="android:fontFamily">sans-serif</item>
<item name="android:windowBackground">@color/background</item>
<item name="android:buttonStyle">@style/AppTheme.Button</item>
<item name="android:textViewStyle">@style/AppTheme.TextView</item>
<item name="android:editTextStyle">@style/AppTheme.EditText</item>
<item name="android:checkboxStyle">@style/AppTheme.CheckBox</item>
</style>
button style:
<style name="AppTheme.Button" parent="android:Widget.Button">
<item name="android:background">@drawable/button_background</item>
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/normal_text</item>
</style>
I can see it properly on the Android Studio preview, but doesn't work on device. It works on device if I set it in the element inside the layout.
<Button
android:id="@+id/btn_login"
style="@style/AppTheme.Button"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="LOGIN"/>
I just want to define it in the AppTheme
Aucun commentaire:
Enregistrer un commentaire