anastr / SpeedView

Dynamic Speedometer and Gauge for Android. amazing, powerful, and multi shape :zap:
Apache License 2.0
1.29k stars 324 forks source link

SpeedView is not showing up in android studio in the layout editor #110

Closed 4bernard closed 5 years ago

4bernard commented 6 years ago

I'm using 1.3.0. Android studio 3.1.4.

The code runs as expected but why don't I see the object in the layout editor? I've tried with RelativeLayout and ConstraintLayout.

When I use a library what is the magic for integrating a specific project widget in the layout editor?

I've tried clean project, sync with gradle and build. Something is missing?

I did not add:

in.unicodelabs.sorbh kdgaugeview 1.0.0 pom

is that what is missing? in which file should it go?

screenshot from 2018-09-22 06-46-47

<?xml version="1.0" encoding="utf-8"?> <android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".MainActivity"> <com.github.anastr.speedviewlib.SpeedView android:id="@+id/speedView" android:layout_width="wrap_content" android:layout_height="wrap_content" />

anastr commented 6 years ago

All speedometers are showing in the layout editor, make sure have built your project.

4bernard commented 6 years ago

First point: the library is great!!! :) I worked around adding the speedView in a frameLayout but it is not ideal. I use a ConstraintLayout and the SpeedView has a side effect because I used to see the FL but they now have disappeared. I've only added the line in gradle implementation 'com.github.anastr:speedviewlib:1.3.0' Did I miss a step?

screenshot from 2018-09-22 18-45-16

and I have now a render issue:

java.lang.ArrayIndexOutOfBoundsException: -1 at java.util.ArrayList.elementData(ArrayList.java:418) at java.util.ArrayList.get(ArrayList.java:431) at com.android.layoutlib.bridge.impl.GcSnapshot.draw(GcSnapshot.java:593) at android.graphics.BaseCanvas_Delegate.draw(BaseCanvas_Delegate.java:558) at android.graphics.BaseCanvas_Delegate.nDrawPath(BaseCanvas_Delegate.java:324) at android.graphics.BaseCanvas.nDrawPath(BaseCanvas.java) at android.graphics.BaseCanvas.drawPath(BaseCanvas.java:298) at android.graphics.Canvas.drawPath(Canvas.java:1652) at com.github.anastr.speedviewlib.SpeedView.updateBackgroundBitmap(SpeedView.java:117) at com.github.anastr.speedviewlib.Gauge.onAttachedToWindow(Gauge.java:713) at android.view.View.dispatchAttachedToWindow(View.java:17445) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3333) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3333) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3333) at android.view.ViewGroup.dispatchAttachedToWindow(ViewGroup.java:3333) at android.view.AttachInfo_Accessor.setAttachInfo(AttachInfo_Accessor.java:42) at com.android.layoutlib.bridge.impl.RenderSessionImpl.inflate(RenderSessionImpl.java:334) at com.android.layoutlib.bridge.Bridge.createSession(Bridge.java:384) at com.android.tools.idea.layoutlib.LayoutLibrary.createSession(LayoutLibrary.java:193) at com.android.tools.idea.rendering.RenderTask.createRenderSession(RenderTask.java:544) at com.android.tools.idea.rendering.RenderTask.lambda$inflate$3(RenderTask.java:678) 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)

anastr commented 5 years ago

this bug is about to fix in next version, please follow issue #113