簡體   English   中英

主屏幕小部件中的自定義布局

[英]Custom Layout in Homescreen Widget

我正在開發一個具有許多不同大小按鈕的主屏幕小部件。 為了最大限度地利用空間,我想為此小部件使用流布局(出於某種瘋狂的原因,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>

假定編輯的名稱空間正確,是否有任何方法可以做我想要的事情,或者不可能將自定義布局與主屏幕小部件一起使用?

主屏幕小部件不受限制,它們不支持自定義布局: https : //developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM