Select theme in Android Studio

Asked

Viewed 3,769 times

2

When I select a theme in Android Studio, like this Holo I changed, it changes the preview but when I run the application on my device does not change anything. Anyone can help ?

inserir a descrição da imagem aqui

  • You need to change in Styles.xml. Check this link http://developer.android.com/intl/pt-br/guide/topics/ui/themes.html. Abs.

2 answers

3


You are just changing the preview theme of Android Studio. to change the theme of the app you need to go to your Androidmanifest.xml file

and on the tag application changes the Theme parameter.

<application
        android:theme="@android:style/Theme.Translucent" >

This is just one example: To view other themes or create your custom see the following link: http://developer.android.com/guide/topics/ui/themes.html

1

In Styles.xml, you will see the theme used in your application, as in this example:

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
        <!-- Customize your theme here. -->
        <item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
    </style>

    <style name="AppTheme.NoActionBar">
        <item name="windowActionBar">false</item>
        <item name="windowNoTitle">true</item>
    </style>

    <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />

    <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />

</resources>

Note that the code above has colors that were externalized in the file "Colors.xml", which is in the folder "values", with the following code:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <color name="colorPrimary">#E76D00</color>
    <color name="colorPrimaryDark">#E76D00</color>
    <color name="colorAccent">#E76D00</color>

    <color name="colorTextView">#ff606060</color>
    <color name="colorTextViewDark">#ff020202</color>
</resources>

Already to edit your app’s theme, Android Studio provides a standard editor for themes - with the Android Studio IDE open, go to the menu tools > Android > Theme Editor and there make the changes as you wish.

Now it’s just typing CTRL+S and then CTRL+F9 to see the result.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.