[英]No resource identifier found for attribute 'text color' in package 'android' — When building
[英]no resource identifier found when using AndroidTreeView
我嘗試使用AndroidTreeView
https://github.com/bmelnychuk/AndroidTreeView
但是在按照說明進行導入之后,我現在在資源layout_selectable_item.xml中收到以下錯誤,該錯誤是我從軟件包隨附的演示復制到項目中的。
Error:(37) No resource identifier found for attribute 'iconText' in package 'android'
Error:(37) No resource identifier found for attribute 'iconColor' in package 'android'
Error:(37) No resource identifier found for attribute 'iconFont' in package 'android'
Error:(37) No resource identifier found for attribute 'iconSize' in package 'android'
如果我用xml文件中的錯誤注釋掉行,則treeView可以工作,但是其中沒有圖標,而且看起來很爛,所以我認為這些行是必需的,但是錯誤當然...
要導入它,我所做的就是將這行添加到gradle中,然后開始在我的代碼中使用樹形視圖,並且可以正常工作(但看上去很糟糕)。
compile 'com.github.bmelnychuk:atv:1.2.+'
這是xml文件,有人可以幫忙嗎?
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:minHeight="48dp"
android:paddingLeft="10dp"
android:background="?android:attr/selectableItemBackground"
android:layout_height="match_parent">
<CheckBox
android:visibility="gone"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:layout_alignParentLeft="true"
android:id="@+id/node_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<LinearLayout
android:layout_centerHorizontal="true"
android:layout_marginLeft="28dp"
android:layout_alignWithParentIfMissing="true"
android:layout_toRightOf="@id/node_selector"
android:orientation="vertical"
android:id="@+id/picture_wrapper"
android:layout_width="wrap_content"
android:layout_centerVertical="true"
android:layout_height="wrap_content">
<View
android:id="@+id/top_line"
android:background="#12558C"
android:layout_gravity="center_horizontal"
android:layout_width="1dp"
android:layout_height="16dp" />
<com.github.johnkil.print.PrintView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:iconText="@string/ic_check_circle_blank"
android:iconColor="#12558C"
android:iconFont="fonts/material-icon-font.ttf"
android:iconSize="16dp" />
<View
android:id="@+id/bot_line"
android:background="#12558C"
android:layout_gravity="center_horizontal"
android:layout_width="1dp"
android:layout_height="16dp" />
</LinearLayout>
<TextView
android:layout_centerVertical="true"
android:textSize="16sp"
android:layout_marginLeft="10dp"
android:layout_toRightOf="@+id/picture_wrapper"
android:id="@+id/node_value"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</RelativeLayout>
從github頁面: https : //github.com/johnkil/Print
自定義視圖
在布局中將PrintView用作單個圖標。
<com.github.johnkil.print.PrintView android:layout_width="wrap_content" android:layout_height="wrap_content" app:print_iconText="@string/ic_android" app:print_iconColor="@color/icon_color" app:print_iconSize="@dimen/icon_size"/>
將實現'com.github.johnkil.print:print:1.3.1'添加到build.gradle文件中。 同樣不要忘記將material-icon-font.ttf添加到main / assets / fonts
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
PrintConfig.initDefault(getAssets(), "fonts/material-icon-font.ttf");
...
}
您需要使用應用程序名稱空間,而不是android:
<com.github.johnkil.print.PrintView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:iconText="@string/ic_check_circle_blank"
app:iconColor="#12558C"
app:iconFont="fonts/material-icon-font.ttf"
app:iconSize="16dp" />
我讓它工作了,只是不斷嘗試不同的東西,不知道是什么組合使它無法正常工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.