[英]No resource identifier found for attribute 'menu' in package in Android
[英]No resource identifier found for attribute 'textcolor' in package 'android'
我在main_activity中不斷出錯。 錯誤:-在“ android”包中找不到屬性“ textcolor”的資源標識符
主要活動的代碼是這個
<?xml version="1.0" encoding="utf-8"?>
<linearlayout android:layout_height="fill_parent"
android:layout_width="fill_parent"
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">
<imageview android:id="@+id/imageView_pic"
android:layout_gravity="center"
android:layout_height="100dp"
android:layout_width="100dp">
<button android:id="@+id/button_selectpic"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:text="Select Picture">
</button><button android:id="@+id/uploadButton"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text="Click To Upload File">
<textview android:id="@+id/messageText"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text=""
android:textcolor="#000000"
android:textstyle="bold">
</textview>
</button>
</imageview>
</linearlayout>
Android小部件采用駝峰式,因此
imageview
是ImageView
textview
是TextView
等等。 另外,擴展View的元素(例如Button,ImageView,TextView)不能有子級,因此您必須立即關閉標記。 例如:
<TextView android:id="@+id/messageText"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:text=""
android:textcolor="#000000"
android:textstyle="bold" />
正如@DoctorDrive正確指出的那樣,有些屬性也是駝峰式的,因此android:textcolor
是android:textColor
和android:textstyle="bold"
是android:textStyle="bold"
它是textColor
和textStyle
而不是textcolor
和textstyle
除了給出的答案之外,您還要在TextView之后關閉Button。 例如,beltbelt關於關閉標簽的內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.