Max Ehrlich
Max Ehrlich

Reputation: 2525

Custom Layout in Homescreen Widget

I am developing a homescreen widget that has a number of different sized buttons. To maximize the use of space, I want to use a flow layout for this widget (which for some crazy reason, android has no native implementation of).

To solve this, I have tried using third party implementations and implemented the layout myself, however, I always get an exception when loading the widget:

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]]

My layout for the widget looks only like this:

<[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>

Assuming that the redacted namespace is correct, is there any way to do what I want or is it impossible to use a custom layout with a homescreen widget?

Upvotes: 0

Views: 155

Answers (1)

Oleg Vladimirov
Oleg Vladimirov

Reputation: 157

Home screen widgets are wery limitted things, they doesn't support custom layouts: https://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout

Upvotes: 2

Related Questions