尝试在 .net MAUI 中迁移 SearchBar 自定义渲染器时出现 Android.Views.InflateException

问题描述 投票:0回答:1

有人在下面的 git 链接中报告了我的确切问题和相同的代码。代码示例也存在于 GIT 报告的问题中。 将我的 Xamarin 应用程序迁移到 MAUI 以及使用自定义 SeachBar/SearchBarRenderer 时,应用程序崩溃并出现以下错误。

GIT 链接:https://github.com/dotnet/maui/issues/22522

有人有相同的解决方案或面临类似的问题并找到替代方案吗?

    {Android.Views.InflateException: Binary XML file line #93 in com.extendaretail.mobileaccess:layout/abc_search_view: Binary XML file line #93 in com.extendaretail.mobileaccess:layout/abc_search_view: Error inflating class <unknown>
 ---> Android.Views.InflateException: Binary XML file line #93 in com.extendaretail.mobileaccess:layout/abc_search_view: Error inflating class <unknown>
 ---> Java.Lang.Reflect.InvocationTargetException: Exception of type 'Java.Lang.Reflect.InvocationTargetException' was thrown.
 ---> Java.Lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0303c3 a=-1}, theme={InheritanceMap=[id=0x7f10021bcom.extendaretail.mobileaccess:style/Theme.AppCompat.Empty], Themes=[com.extendaretail.mobileaccess:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}

  --- End of managed Java.Lang.UnsupportedOperationException stack trace ---
java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0303c3 a=-1}, theme={InheritanceMap=[id=0x7f10021bcom.extendaretail.mobileaccess:style/Theme.AppCompat.Empty], Themes=[com.extendaretail.mobileaccess:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
    at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1007)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:991)
    at android.view.View.<init>(View.java:5579)
    at android.widget.ImageView.<init>(ImageView.java:196)
    at android.widget.ImageView.<init>(ImageView.java:191)
    at android.widget.ImageView.<init>(ImageView.java:187)
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at android.view.LayoutInflater.createView(LayoutInflater.java:858)
    at android.view.LayoutInflater.createView(LayoutInflater.java:780)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:290)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:276)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:272)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.n_onCreateView(Native Method)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.onCreateView(NavigationViewFragment.java:42)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3042)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:114)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1455)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3034)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

  --- End of managed Java.Lang.UnsupportedOperationException stack trace ---
java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0303c3 a=-1}, theme={InheritanceMap=[id=0x7f10021bcom.extendaretail.mobileaccess:style/Theme.AppCompat.Empty], Themes=[com.extendaretail.mobileaccess:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
    at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1007)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:991)
    at android.view.View.<init>(View.java:5579)
    at android.widget.ImageView.<init>(ImageView.java:196)
    at android.widget.ImageView.<init>(ImageView.java:191)
    at android.widget.ImageView.<init>(ImageView.java:187)
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at android.view.LayoutInflater.createView(LayoutInflater.java:858)
    at android.view.LayoutInflater.createView(LayoutInflater.java:780)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:290)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:276)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:272)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.n_onCreateView(Native Method)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.onCreateView(NavigationViewFragment.java:42)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3042)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:114)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1455)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3034)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

   --- End of inner exception stack trace ---

  --- End of managed Java.Lang.Reflect.InvocationTargetException stack trace ---
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at android.view.LayoutInflater.createView(LayoutInflater.java:858)
    at android.view.LayoutInflater.createView(LayoutInflater.java:780)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:290)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:276)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:272)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.n_onCreateView(Native Method)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.onCreateView(NavigationViewFragment.java:42)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3042)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:114)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1455)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3034)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0303c3 a=-1}, theme={InheritanceMap=[id=0x7f10021bcom.extendaretail.mobileaccess:style/Theme.AppCompat.Empty], Themes=[com.extendaretail.mobileaccess:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
    at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1007)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:991)
    at android.view.View.<init>(View.java:5579)
    at android.widget.ImageView.<init>(ImageView.java:196)
    at android.widget.ImageView.<init>(ImageView.java:191)
    at android.widget.ImageView.<init>(ImageView.java:187)
    ... 52 more

  --- End of managed Java.Lang.Reflect.InvocationTargetException stack trace ---
java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at android.view.LayoutInflater.createView(LayoutInflater.java:858)
    at android.view.LayoutInflater.createView(LayoutInflater.java:780)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:290)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:276)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:272)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.n_onCreateView(Native Method)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.onCreateView(NavigationViewFragment.java:42)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3042)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:114)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1455)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3034)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0303c3 a=-1}, theme={InheritanceMap=[id=0x7f10021bcom.extendaretail.mobileaccess:style/Theme.AppCompat.Empty], Themes=[com.extendaretail.mobileaccess:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
    at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1007)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:991)
    at android.view.View.<init>(View.java:5579)
    at android.widget.ImageView.<init>(ImageView.java:196)
    at android.widget.ImageView.<init>(ImageView.java:191)
    at android.widget.ImageView.<init>(ImageView.java:187)
    ... 52 more

   --- End of inner exception stack trace ---

  --- End of managed Android.Views.InflateException stack trace ---
android.view.InflateException: Binary XML file line #93 in com.extendaretail.mobileaccess:layout/abc_search_view: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at android.view.LayoutInflater.createView(LayoutInflater.java:858)
    at android.view.LayoutInflater.createView(LayoutInflater.java:780)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:290)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:276)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:272)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.n_onCreateView(Native Method)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.onCreateView(NavigationViewFragment.java:42)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3042)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentStore.moveToExpectedState(FragmentStore.java:114)
    at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1455)
    at androidx.fragment.app.FragmentManager.dispatchStateChange(FragmentManager.java:3034)
    at androidx.fragment.app.FragmentManager.dispatchViewCreated(FragmentManager.java:2945)
    at androidx.fragment.app.Fragment.performViewCreated(Fragment.java:3148)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:588)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:272)
    at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1943)
    at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1845)
    at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1782)
    at androidx.fragment.app.FragmentManager$5.run(FragmentManager.java:565)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
Caused by: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 13: TypedValue{t=0x2/d=0x7f0303c3 a=-1}, theme={InheritanceMap=[id=0x7f10021bcom.extendaretail.mobileaccess:style/Theme.AppCompat.Empty], Themes=[com.extendaretail.mobileaccess:style/Theme.AppCompat.Empty, forced, android:style/Theme.DeviceDefault.Light.DarkActionBar, forced]}
    at android.content.res.TypedArray.getDrawableForDensity(TypedArray.java:1007)
    at android.content.res.TypedArray.getDrawable(TypedArray.java:991)
    at android.view.View.<init>(View.java:5579)
    at android.widget.ImageView.<init>(ImageView.java:196)
    at android.widget.ImageView.<init>(ImageView.java:191)
    at android.widget.ImageView.<init>(ImageView.java:187)
    ... 52 more

  --- End of managed Android.Views.InflateException stack trace ---
android.view.InflateException: Binary XML file line #93 in com.extendaretail.mobileaccess:layout/abc_search_view: Error inflating class <unknown>
Caused by: java.lang.reflect.InvocationTargetException
    at java.lang.reflect.Constructor.newInstance0(Native Method)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:343)
    at android.view.LayoutInflater.createView(LayoutInflater.java:858)
    at android.view.LayoutInflater.createView(LayoutInflater.java:780)
    at com.android.internal.policy.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:58)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:934)
    at android.view.LayoutInflater.onCreateView(LayoutInflater.java:954)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:1008)
    at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:965)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1127)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.rInflate(LayoutInflater.java:1130)
    at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:1088)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:686)
    at android.view.LayoutInflater.inflate(LayoutInflater.java:538)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:290)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:276)
    at androidx.appcompat.widget.SearchView.<init>(SearchView.java:272)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.n_onCreateView(Native Method)
    at crc6452ffdc5b34af3a0f.NavigationViewFragment.onCreateView(NavigationViewFragment.java:42)
    at androidx.fragment.app.Fragment.performCreateView(Fragment.java:3114)
    at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:557)
    at androidx.fragment.app.FragmentStateManager.moveToExpectedState(FragmentStateManager.java:27
xamarin.forms maui searchbar custom-renderer
1个回答
0
投票

从.NET MAUI Shell搜索文档中我们可以发现SearchHandler被设计为添加在页面顶部。

SearchHandler 添加在 ContentPage 内部,如果将其放在其他位置,则不会显示。

我想要在多个页面中搜索处理程序,但搜索处理程序无法实现多个位置,并且无法实现除页面顶部之外的内部布局。

© www.soinside.com 2019 - 2024. All rights reserved.