【发布时间】:2023-03-17 02:33:01
【问题描述】:
我正在开发一个具有许多不同大小按钮的主屏幕小部件。为了最大限度地利用空间,我想为这个小部件使用流式布局(出于某种疯狂的原因,android 没有本机实现)。
为了解决这个问题,我尝试使用第三方实现并自己实现了布局,但是,加载小部件时总是出现异常:
W/AppWidgetHostView: updateAppWidget couldn't find any view, using error view
android.view.InflateException: Binary XML file line #1: Binary XML file line #1: Error inflating class [redacted].FlowLayout
Caused by: android.view.InflateException: Binary XML file line #1: Error inflating class [redacted].FlowLayout
Caused by: java.lang.ClassNotFoundException: Didn't find class "[redacted].FlowLayout" on path: DexPathList[[zip file "/system/priv-app/Velvet/Velvet.apk"],nativeLibraryDirectories=[/system/priv-app/Velvet/lib/arm64, /system/priv-app/Velvet/Velvet.apk!/lib/arm64-v8a, /system/lib64, /vendor/lib64, /system/lib64, /vendor/lib64]]
我的小部件布局如下所示:
<[redacted].FlowLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#09C"
android:padding="@dimen/widget_margin"
android:id="@+id/widgetRoot"
android:orientation="horizontal">
</[redacted].FlowLayout>
假设编辑的命名空间是正确的,有什么方法可以做我想做的,还是不可能使用带有主屏幕小部件的自定义布局?
【问题讨论】: