2017-03-17 84 views
-2
<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.kun.www.love.MainActivity"> 
    <ImageView 
     android:layout_width="match_parent" 
     android:layout_height="match_parent" 
     android:src="@drawable/party" 
     android:scaleType="centerCrop"/> 
    <TextView 
     android:text="Happy Birthday, Kun" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:textColor="@android:color/white" 
     android:textSize="36sp" 
     android:fontFamily="san-serif-light" 
     android:layout_marginTop="20dp" 
     android:layout_marginLeft="20dp"/> 
    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="@string/Love" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:textColor="@android:color/white" 
     android:textSize="36sp" 
     android:fontFamily="san-serif-light" 
     android:layout_marginBottom="20dp" 
     android:layout_marginRight="20dp"/> 
</RelativeLayout> 


<resources> 
    <string 
     name="Love" 
     >From Kun</string> 
</resources> 

这是错误。我试着解决它,但是我失败了。 我是初学者,我真的需要你的帮助。 非常感谢。找不到与给定名称匹配的资源('label'值'@ string/app_name')

enter image description here enter image description here

回答

0

检查文件RES /价值/ strings.xml中有APP_NAME或不?如果不加

<string name="app_name">"Your App name"</string> 
0

添加在您的清单文件中的应用程序标签下面这行

android:label="@string/app_name" 

以及在string.xml文件中添加下面一行保存在

<string name="app_name">App Name</string> 
+0

感谢您的帮助。 – Kun

0

XML文件res/values/strings.xml

<?xml version="1.0" encoding="utf-8"?> 
<resources> 
    <string 
     name="Love" 
     >From Kun</string> 
</resources> 

也有这个

<string name="app_name">"My App"</string> 
相关问题