-2

A string underline on emulator (and device) is green but on designer window is gray. There is no custom colors in style and colors.xml. So why colors are different?

result

manifest.xml:

    <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.myfirstapp">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name="com.example.myfirstapp.MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
        <activity android:name="com.example.myfirstapp.DisplayMessageActivity"
            android:parentActivityName="com.example.myfirstapp.MainActivity">
            <!--The meta-data tag is required if you support API level 15 and lower -->
            <meta-data
                android:name="android.support.PARENT_ACTIVITY"
                android:value="com.example.myfirstapp.MainActivity"/>
        </activity>
    </application>

</manifest>

colors.xml:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!--<color name="colorPrimary">#087609</color>
    <color name="colorPrimaryDark">#002900</color>
    <color name="colorAccent">#327f4f</color>-->
</resources>

styles.xml:

<resources>

    <!-- Base application theme. -->

    <style name="AppTheme" parent="Theme.AppCompat">
        <!-- Customize your theme here. -->

        <!--<item name="colorPrimary">@color/colorPrimary</item>
        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
        <item name="colorAccent">@color/colorAccent</item>
        -->
    </style>

</resources>

manifest.xml

colors.xml

styles.xml

PS: sorry for images on links - i have no enough reputation to post images directly.

SSpade
  • 133
  • 1
  • 6
  • please read this: https://stackoverflow.com/help/how-to-ask – GuilhermeFGL May 10 '18 at 19:59
  • You do have enough reputation for copying and pasting the code (image of sample/desired output is OK, but not for code). If you put the code as an image people can't copy it for testing possible answers. Also, it takes less work copying and pasting the code than taking a screen shot, uploading it to some site and putting the link. – Alberto Martinez May 10 '18 at 22:31
  • Ok. Thank you. In this case i thought that my code is not to be copied because - almost all is commented (colors and styles settings) and this screenshots are here only to show - i don't use any overrides of colors of theme. But you are right - copied code looks better than links to screens. – SSpade May 12 '18 at 11:44

1 Answers1

0

Well... it's gray in the designer window because it's not active there (obviously) and it's teal in the emulator because it's Android's default accent color. Try to change colorAccent value to change default color to some else color

Hamstersztyk
  • 158
  • 13