Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ElevatedDrawable not working even after setting clipChildren = false #11

Open
UvrajSB opened this issue Sep 30, 2021 · 3 comments
Open

Comments

@UvrajSB
Copy link

UvrajSB commented Sep 30, 2021

<androidx.cardview.widget.CardView
    android:clipToPadding="false"
    android:layout_margin="20dp"
    android:id="@+id/kindle_parent_card_detail"
    android:background="@drawable/kindle_card"
    app:cardBackgroundColor="@color/cool_gray"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:theme="@style/ThemeOverlay.Neumorph.Dark"
    style="@style/Widget.Neumorph.CardView"
    android:clipChildren="false">


        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical"
            android:layout_margin="30dp"
            android:elevation="50dp"
            android:clipChildren="false">
        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:textSize="15sp"
            android:layout_marginHorizontal="20dp"
            android:fontFamily="@font/poppins"
            android:textColor="@color/white"
            android:id="@+id/highlight_text"/>
        <androidx.cardview.widget.CardView
            android:layout_width="wrap_content"
            android:layout_height="20dp"
            app:cardCornerRadius="10dp"
            android:paddingHorizontal="10dp"
            android:layout_centerHorizontal="true"
            app:cardBackgroundColor="@color/black"
            android:layout_below="@id/highlight_text"
            android:clipChildren="false">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="20dp"
                android:id="@+id/name_of_kindle"
                android:textSize="12sp"
                android:textColor="@color/lime"
                android:text="A General Introduction to Psychoanalysis"/>
        </androidx.cardview.widget.CardView>
        </LinearLayout>
</androidx.cardview.widget.CardView>
@UvrajSB
Copy link
Author

UvrajSB commented Sep 30, 2021

holder.parent_card.background = ElevatedDrawable(NeuPlatformAppearance(SynthUtils.defaultBaseColor),40f,20f)

@UvrajSB
Copy link
Author

UvrajSB commented Sep 30, 2021

I am facing this issue multiple times, even after setting clipChildren = false in parent view
The bakground do come with a shade but it appears clipped

@rishabhsinghbisht
Copy link

rishabhsinghbisht commented May 8, 2022

Most likely your shadows are getting outside your parent’s bounds. So you’ll have to add clipChildren = false to the next immediate parent too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants