gpt4 book ai didi

预览布局具有自定义 View 时 Android Studio 3.2 的异常

转载 作者:太空宇宙 更新时间:2023-11-03 10:58:03 29 4
gpt4 key购买 nike

Android Studio 3.2 预览布局时;
多个模块中解析资源的id时似乎很困惑。
我在另一个模块中的 customView。
顺便说一下,Android Studio 3.1.4 正在运行

Could not resolve resource value: 0x7F0F0117. Or the resolved value was not of type layout as expected.

android.content.res.Resources$NotFoundException: Could not resolve resource value: 0x7F0F0117. Or the resolved value was not of type layout as expected.
at android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1117)
at android.content.res.Resources_Delegate.throwException(Resources_Delegate.java:1093)
at android.content.res.Resources_Delegate.getLayout(Resources_Delegate.java:497)
at android.content.res.Resources.getLayout(Resources.java:1155)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at com.******.widget.HotKeyEditView.initView(HotKeyEditView.java:44)
at com.******.widget.HotKeyEditView.<init>(HotKeyEditView.java:34)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at org.jetbrains.android.uipreview.ViewLoader.createNewInstance(ViewLoader.java:401)
at org.jetbrains.android.uipreview.ViewLoader.loadClass(ViewLoader.java:184)
at org.jetbrains.android.uipreview.ViewLoader.loadView(ViewLoader.java:142)
at com.android.tools.idea.rendering.LayoutlibCallbackImpl.loadView(LayoutlibCallbackImpl.java:229)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:421)
at android.view.BridgeInflater.loadCustomView(BridgeInflater.java:432)
at android.view.BridgeInflater.createViewFromTag(BridgeInflater.java:336)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:863)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:866)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:866)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater_Delegate.parseInclude(LayoutInflater_Delegate.java:162)
at android.view.LayoutInflater.parseInclude(LayoutInflater.java:900)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:859)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:866)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:866)
at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:72)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:837)
at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824)
at android.view.LayoutInflater.inflate(LayoutInflater.java:515)
at android.view.LayoutInflater.inflate(LayoutInflater.java:394)
at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:327)
at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:386)
at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193)
at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:450)
at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:590)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

最佳答案

如评论中所述,this is a bug in Android Studio .我找到了解决此问题的方法,即在 app 模块中创建一个布局,该布局只包含 lib 模块中渲染有问题的布局。然后您可以编辑 lib 布局并查看包含它的应用程序布局的更改。

关于预览布局具有自定义 View 时 Android Studio 3.2 的异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52732902/

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