gpt4 book ai didi

android - 错误膨胀类 com.astuetz.PagerSlidingTabStrip

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:02:50 24 4
gpt4 key购买 nike

在我将我的 Android studio 从 2.3.3 更新到 3.0 并在编译和运行后出现此错误(rror inflating class com.astuetz.PagerSlidingTabStrip)请查看下面的日志错误:

android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2643)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2709)
at android.app.ActivityThread.access$1000(ActivityThread.java:196)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:207)
at android.app.ActivityThread.main(ActivityThread.java:5867)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1026)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:887)
Caused by: android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
at android.view.LayoutInflater.inflate(LayoutInflater.java:545)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429)
at android.view.LayoutInflater.inflate(LayoutInflater.java:380)
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:436)
at android.app.Activity.setContentView(Activity.java:2205)
at com.goalplusapp.goalplus.MainActivity.onCreate(MainActivity.java:325)
at android.app.Activity.performCreate(Activity.java:6285)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2709) 
at android.app.ActivityThread.access$1000(ActivityThread.java:196) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5867) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1026) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:887) 
Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.astuetz.PagerSlidingTabStrip
at android.view.LayoutInflater.createView(LayoutInflater.java:654)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:809)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:880)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843)
at android.view.LayoutInflater.inflate(LayoutInflater.java:521)
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:436) 
at android.app.Activity.setContentView(Activity.java:2205) 
at com.goalplusapp.goalplus.MainActivity.onCreate(MainActivity.java:325) 
at android.app.Activity.performCreate(Activity.java:6285) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2709) 
at android.app.ActivityThread.access$1000(ActivityThread.java:196) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5867) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1026) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:887) 
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at android.view.LayoutInflater.createView(LayoutInflater.java:628)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:809) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:880) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:521) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:436) 
at android.app.Activity.setContentView(Activity.java:2205) 
at com.goalplusapp.goalplus.MainActivity.onCreate(MainActivity.java:325) 
at android.app.Activity.performCreate(Activity.java:6285) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2709) 
at android.app.ActivityThread.access$1000(ActivityThread.java:196) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5867) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1026) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:887) 
Caused by: java.lang.UnsupportedOperationException: Can't convert to color: type=0x5
at android.content.res.TypedArray.getColor(TypedArray.java:451)
at com.astuetz.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:144)
at com.astuetz.PagerSlidingTabStrip.<init>(PagerSlidingTabStrip.java:106)
at java.lang.reflect.Constructor.newInstance(Native Method) 
at android.view.LayoutInflater.createView(LayoutInflater.java:628) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:809) 
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:749) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:880) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843) 
at android.view.LayoutInflater.rInflate(LayoutInflater.java:883) 
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:843) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:521) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:429) 
at android.view.LayoutInflater.inflate(LayoutInflater.java:380) 
at com.android.internal.policy.PhoneWindow.setContentView(PhoneWindow.java:436) 
at android.app.Activity.setContentView(Activity.java:2205) 
at com.goalplusapp.goalplus.MainActivity.onCreate(MainActivity.java:325) 
at android.app.Activity.performCreate(Activity.java:6285) 
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1119) 
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2596) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2709) 
at android.app.ActivityThread.access$1000(ActivityThread.java:196) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1534) 
at android.os.Handler.dispatchMessage(Handler.java:111) 
at android.os.Looper.loop(Looper.java:207) 
at android.app.ActivityThread.main(ActivityThread.java:5867) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1026) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:887) 

最佳答案

尝试使用此信息更改您的 .xml:

<com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs_quotation_track"
android:layout_width="match_parent"
android:layout_height="48dip"
android:background="@drawable/background_tabs"
android:layout_marginTop="20dp"/>

在我的例子中,问题出在 Android 设备 7.0 上,我正在使用

    <com.astuetz.PagerSlidingTabStrip
android:id="@+id/tabs_quotation_track"
android:layout_width="match_parent"
android:layout_height="48dip"
android:background="@drawable/background_tabs"
app:pstsShouldExpand="true"/>

我认为问题出在 pstsShouldExpand,或者说 margin top 是必要的。

问候。

关于android - 错误膨胀类 com.astuetz.PagerSlidingTabStrip,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47006086/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com