Continuing problems running Android Apps

后端 未结 2 1363
旧巷少年郎
旧巷少年郎 2021-01-21 18:38

I have been having a very difficult time with android apps. I\'m using Eclipse, V 4.2.0, and running API version 7. Below is the LogCat output of one program I\'m having difficu

相关标签:
2条回答
  • 2021-01-21 19:15

    I think you need to move your color declaration out of strings.xml and put it inside of colors.xml

    colors.xml

    <?xml version="1.0" encoding="utf-8"?>
    <resources>
    <color name="myColor">#ccff00</color>
    </resources>
    

    Then inside your layout refer to it like this:

    <TextView
    
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:textColor="@color/myColor"
    android:textSize="30dp"
    android:text="@string/text"
    android:textStyle="bold"
    android:gravity="center"
    android:id="@+id/tvDisplay"
    
    />
    
    0 讨论(0)
  • 2021-01-21 19:23

    In your xml, this line is wrong:

    android:textColor="@string/color
    

    You should dbl check that you have a file called "/res/color/color.xml some references to colors written in there.

    Or just change :

    android:textColor="@string/color
    

    to android:textColor="#ff000000"

    0 讨论(0)
提交回复
热议问题