PhilJay / MPAndroidChart

A powerful 🚀 Android chart view / graph view library, supporting line- bar- pie- radar- bubble- and candlestick charts as well as scaling, panning and animations.
Other
37.6k stars 9.02k forks source link

CardView in MarkerView #4990

Open yll090 opened 4 years ago

yll090 commented 4 years ago

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?

snehas13 commented 3 years ago

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

kdani41 commented 3 years ago

@PhilJay Any help will be really appreciated :)

susonthapa commented 3 years ago

I am also facing this issue.

kdani41 commented 3 years ago

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

BMarton commented 2 years ago

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

cmatulessy commented 2 years ago

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.

yusufceylan commented 2 years ago

I think still there is not any solution or update?