Search code examples
androidandroidplot

Setter requires parameter of unsupported type: class com.androidplot.ui.widget.TextLabelWidget


I'm trying to adapt the QuickStart example to my app but so far I'm getting this error: Error inflating XML (class com.androidplot.xy.XYPlot): Setter requires param of unsupported type: class com.androidplot.ui.widget.TextLabelWidget which apparently is a problem with the setContentView( R.layout.activity_graph ); statement in my onCreate() method. I've created the line_point_formatter_with_labels.xml resource as described in QuickStart, but can't find any documentation addressing my problem.

Here's the XYPlot item in my layout file:

<com.androidplot.xy.XYPlot
    android:id="@+id/temp_history"
    style="@style/APDefacto.Dark"
    androidPlot.domainTitle="min"
    androidPlot.lineLabelRotationBottom="-45"
    androidPlot.lineLabels="left|bottom"
    androidPlot.rangeTitle="°F"
    androidPlot.title="Temp History"
    android:layout_width="0dp"
    android:layout_height="300dp"
    app:layout_constraintBottom_toTopOf="@id/temp_button"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    tools:layout_margin="36dp" />

All of the androidPlot entries are flagged unknown attribute


Solution

  • Found the problem: I was missing the xmlns:ap item in the layout file. I have always seen these only in the root element of a layout file and didn't realize they could also appear in child View elements. It's present in the sample code but I just missed it.