-1
Je veux gonfler une vue d'un xml, comme ceci:vue Android gonflez erreur
View textView = LayoutInflater.from(context).inflate(R.layout.item_classify_left, null);
Mais j'ai eu une erreur sur le code:
android.view.InflateException: Binary XML file line #2: Error inflating class TextView
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:716)
at android.view.LayoutInflater.inflate(LayoutInflater.java:472)
at android.view.LayoutInflater.inflate(LayoutInflater.java:400)
at android.view.LayoutInflater.inflate(LayoutInflater.java:353)
Il y a la mise en page:
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="40dip"
android:gravity="center"
android:textColor="@drawable/item_classify_left_textcolor_selector"
android:background="@drawable/item_classify_left_background_selector" />
J'ai trouvé quand j'ai supprimé l'android: textColor android: background, It work ok. Mais j'ai vraiment besoin du sélecteur. Il y a le sélecteur:
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/main_background_color" />
<item android:color="@color/item_classify_text_background_normal" />
</selector>
Comment puis-je résoudre cette question?