PDA

View Full Version : AnnotationView deprecation of Width/Height in 2.5



isaac.udy
30.06.2015, 02:33
Hi,

I have recently upgraded to Skobbler 2.5, and am rather confused. I am trying to use custom annotations on the map to show truck drivers where they should go, and what to collect. Basically this means I have about 100 annotations on the map, and I want to either display a tiny little bag icon or a little bin icon. In Skobbler 2.4 this was working fine. However, in Skobbler 2.5, I can't set the width or height of the images. Obviously I have had to move to using ImageViews rather than directly setting the AnnotationView drawable. The icons that I was scaling to 32 pixels are now HUGE and fill up 90% of the map view.

I have tried making the images smaller. This is not acceptable, because they end up blurry and bad looking.
I have tried converting them to bitmaps and scaling the bitmaps, but this doesn't seem to work, and even if it did work, the bitmap scaling is only on Android API 19+ (which isn't acceptable for my use case).
I have tried setting different scaling types and layout parameters for the ImageView, but this also doesn't work.

What am I supposed to do here?

Adela_Silvia
30.06.2015, 14:15
Hi Isaac,

Can you please add the code snippets and the icons that you are using.

Thank you,
Adela

mz87
26.08.2015, 14:18
Same problem here, methods are deprecated but they still work and we can not work without them ..

I changed the code so no deprecated methods are used anymore to


View v = inflator.inflate(R.layout.obj1001, null);
annotationView.setView(v);

But even my view (which contains simple image) has size 32dp x 32dp (I also changed them from 128 to 64) .. icon always is way too big and the same size, no matter what I write in size ..


<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="32dp"
android:src="@drawable/obj1001"
android:scaleType="fitCenter"
android:layout_height="32dp">
</ImageView>

mz87
26.08.2015, 14:31
OK, looks like I've managed to fix this issue



<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="32dp"
android:layout_height="32dp">
<ImageView
android:layout_width="32dp"
android:src="@drawable/obj1001"
android:scaleType="fitCenter"
android:layout_height="32dp">
</ImageView>
</RelativeLayout>


simply wrap it in RelativeLayout

Adela_Silvia
27.08.2015, 10:26
Thanks mz87 for adding the solution here