Open yll090 opened 4 years ago
@PhilJay Any update on above issue? Even i am facing same issue. I am unable render shadow for cardview in marker layout.
@PhilJay Any help will be really appreciated :)
I am also facing this issue.
@almic @PhilJay Can anyone of you please provide some help on this issue?
Did any of you find a solution to this? Or any other way to set drop shadow for MarkerViews?
So for my markerview this elevation wont work. Reason for it is because under the hood everything will be drawn on a canvas. So what we did was basically creating a shadow in our MarkerView XML Layout:
Code:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="oval">
<gradient
android:startColor="#FF808080"
android:endColor="#00000000"
android:gradientRadius="11dp"
android:type="radial" />
</shape>
</item>
<item android:top="1dp" android:left="1dp" android:right="1dp" android:bottom="6dp">
<shape android:shape="oval">
<solid android:color="@android:color/holo_blue_bright" />
<stroke
android:width="3dp"
android:color="@color/white" />
<size
android:width="20dp"
android:height="20dp" />
</shape>
</item>
</layer-list>
As you can see the top, left, right, bottom is there to manipulate the shadow. So in your case I would say you have to create a drawable which is representing the cardview background including your shadow and add it to your markerview. Hope this helps you.
I think still there is not any solution or update?
So I've tried using CardViews inside a layout for a MarkerView. However, the shadow doesn't show at all. The same layout inflated in the fragment (just for testing purposes) inflates just fine and has shadow (I've added hardwareAcceleration, as well as cardUseCompatPadding). I've also tried to add a CardView programmatically to a parent ConstraintLayout (as my CardViews are in CLs) successfully. I suspect it might be something with measure/layout methods in MarkerView as this is the only thing I found that might cause it. Any help with layout/measure methods (I'm fine with creating class implementing the IMarker interface) inflating a CardView properly?