MPAndroidChart icon indicating copy to clipboard operation
MPAndroidChart copied to clipboard

CardView in MarkerView

Open yll090 opened this issue 5 years ago • 7 comments

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?

yll090 avatar Sep 02 '20 15:09 yll090

@PhilJay Any update on above issue? Even i am facing same issue. I am unable render shadow for cardview in marker layout.

snehas13 avatar Apr 19 '21 05:04 snehas13

@PhilJay Any help will be really appreciated :)

kdani41 avatar Jun 28 '21 23:06 kdani41

I am also facing this issue.

susonthapa avatar Jul 26 '21 15:07 susonthapa

@almic @PhilJay Can anyone of you please provide some help on this issue?

kdani41 avatar Jul 26 '21 21:07 kdani41

Did any of you find a solution to this? Or any other way to set drop shadow for MarkerViews?

BMarton avatar Jan 14 '22 12:01 BMarton

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: image

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.

cmatulessy avatar Apr 13 '22 15:04 cmatulessy

I think still there is not any solution or update?

yusufceylan avatar Sep 29 '22 11:09 yusufceylan