-3

android studio

I just make a new project and it doesn't work. Look at the link. Some of files like 'colors.xml', there is a problem that the files are made that way. What can I do?

stl.P
  • 1
  • 1
  • 2
  • Instead of `` use `` and add `` at the head. And use `color` instead of `component`. Example ` #3F51B5 ` – Crammeur Jul 29 '18 at 17:09
  • Duplicate of https://stackoverflow.com/questions/53249677/android-studio-shows-wrong-file-contents/53476487#53476487 – Zoe Apr 30 '19 at 21:24

3 Answers3

0

Try to replace your colors.xml with this :

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

When you want to add a color just add :

<color name="yourColor">#YOURCOLOR</color>

And you can use it like this for example :

android:textColor="@color/colorAccent"
Belbahar Raouf
  • 760
  • 1
  • 4
  • 17
  • Ok. but you know that Originally, It should be in the right format from the start of making the new project. But there is the same problem after deleting and reinstalling the android studio. I don't want to replace my color.xml every time I make a project... – stl.P Aug 01 '18 at 03:30
  • Yes, it should be in the right format. Did you tried to update Android Studio ? Also, try to update your android sdk. – Belbahar Raouf Aug 01 '18 at 12:50
0

You must synchronize your project first once you created a new project to add those dependencies that validate the codes including the Layout Files. The synchronize button is at the right top of the Android Studio.

-1

I figured it out. We can't use capitals in image files.

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Tim Slim
  • 29
  • 1
  • 3