Исключение InflateException при использовании «Tagcloudlink View» в Android

#java #android

#java #Android

Вопрос:

При использовании стороннего инструмента «Tagcloudlink view» в Android Studio он выдает исключение InflateException для тега «com.ns.developer.tagview.widget.Tagcloudlink View» объявлен в layout xml

изменил имя тега на ‘fragment’ и использовал текущее имя тега в качестве атрибута «class», даже попробовал то же самое, изменив «class» на «name».

Код по умолчанию

  <com.ns.developer.tagview.widget.TagCloudLinkView
       xmlns:app="http://schemas.android.com/apk/res-auto"
       android:id="@ id/selected_panchayat"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:layout_span="2"
       android:background="#ffffff"
       android:padding="4dp"
       app:deletableTextColor="#ffffff"
       app:deletableTextSize="6sp"
       app:isDeletable="true"
       app:tagLayoutColor="#64B5F6"
       app:tagTextColor="#ffffff"
       app:tagTextSize="6sp" />
  

Попробуйте 1

 <fragment
       class="com.ns.developer.tagview.widget.TagCloudLinkView"
       xmlns:app="http://schemas.android.com/apk/res-auto"
       android:id="@ id/selected_panchayat"
       android:layout_width="match_parent"
       android:layout_height="match_parent"
       android:layout_span="2"
       android:background="#ffffff"
       android:padding="4dp"
       app:deletableTextColor="#ffffff"
       app:deletableTextSize="6sp"
       app:isDeletable="true"
       app:tagLayoutColor="#64B5F6"
       app:tagTextColor="#ffffff"
       app:tagTextSize="6sp" />

  

Попробуйте 2

  <fragment                         
    android:name="com.ns.developer.tagview.widget.TagCloudLinkView"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@ id/selected_panchayat"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_span="2"
    android:background="#ffffff"
    android:padding="4dp"
    app:deletableTextColor="#ffffff"
    app:deletableTextSize="6sp"
    app:isDeletable="true"
    app:tagLayoutColor="#64B5F6"
    app:tagTextColor="#ffffff"
    app:tagTextSize="6sp" />
  

Сообщение журнала

 E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.nammakshetra.nk, PID: 29133
    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.nammakshetra.nk/com.nammakshetra.nk.activity.BMessageActivity}: android.view.InflateException: Binary XML file line #197: Binary XML file line #197: Error inflating class com.ns.developer.tagview.widget.TagCloudLinkView
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2572)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654)
        at android.app.ActivityThread.-wrap11(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
        at android.os.Handler.dispatchMessage(Handler.java:111)
        at android.os.Looper.loop(Looper.java:207)
        at android.app.ActivityThread.main(ActivityThread.java:5728)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)
     Caused by: android.view.InflateException: Binary XML file line #197: Binary XML file line #197: Error inflating class com.ns.developer.tagview.widget.TagCloudLinkView
        at android.view.LayoutInflater.inflate(LayoutInflater.java:539)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469)
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140)
        at com.nammakshetra.nk.activity.BMessageActivity.onCreate(BMessageActivity.java:187)
        at android.app.Activity.performCreate(Activity.java:6309)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5728) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
     Caused by: android.view.InflateException: Binary XML file line #197: Error inflating class com.ns.developer.tagview.widget.TagCloudLinkView
        at android.view.LayoutInflater.createView(LayoutInflater.java:645)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838)
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
        at com.nammakshetra.nk.activity.BMessageActivity.onCreate(BMessageActivity.java:187) 
        at android.app.Activity.performCreate(Activity.java:6309) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5728) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
     Caused by: java.lang.reflect.InvocationTargetException
        at java.lang.reflect.Constructor.newInstance(Native Method)
        at android.view.LayoutInflater.createView(LayoutInflater.java:619)
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
        at com.nammakshetra.nk.activity.BMessageActivity.onCreate(BMessageActivity.java:187) 
        at android.app.Activity.performCreate(Activity.java:6309) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5728) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 
     Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x5
        at android.content.res.TypedArray.getColor(TypedArray.java:451)
        at com.ns.developer.tagview.widget.TagCloudLinkView.initialize(TagCloudLinkView.java:137)
        at com.ns.developer.tagview.widget.TagCloudLinkView.<init>(TagCloudLinkView.java:99)
        at java.lang.reflect.Constructor.newInstance(Native Method) 
        at android.view.LayoutInflater.createView(LayoutInflater.java:619) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:764) 
        at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:704) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:835) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.rInflate(LayoutInflater.java:838) 
        at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:798) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:515) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:423) 
        at android.view.LayoutInflater.inflate(LayoutInflater.java:374) 
        at android.support.v7.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:469) 
        at android.support.v7.app.AppCompatActivity.setContentView(AppCompatActivity.java:140) 
        at com.nammakshetra.nk.activity.BMessageActivity.onCreate(BMessageActivity.java:187) 
        at android.app.Activity.performCreate(Activity.java:6309) 
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1113) 
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2519) 
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2654) 
        at android.app.ActivityThread.-wrap11(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488) 
        at android.os.Handler.dispatchMessage(Handler.java:111) 
        at android.os.Looper.loop(Looper.java:207) 
        at android.app.ActivityThread.main(ActivityThread.java:5728) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679)