Muddz / QuickShot

[Moved to MavenCentral] Capture images of any View, SurfaceView or Bitmap from your Android app in: .jpg .png or .nomedia with simple oneliner codes.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rounded CardView problem

iVoider opened this issue · comments

Hello!

I'm trying to make screenshot of layout with rounded CardView inside.

<androidx.cardview.widget.CardView android:innerRadius="0dp" android:shape="ring" app:cardElevation="0dp" app:cardCornerRadius="75dp">

It is rendered correctly on device, but is square on screenshot.Any idea how to fix it?

Hi. Could you share the whole layout xml + the Pixelshot code?

I also encounter this problem. I use a cardview as container in my item layout, when I drag this item the shadow of the cardview disappear. then, I finde this method:

private Bitmap createDraggingItemImage(View v, NinePatchDrawable shadow)

I thinke this method return a bitmap without this shadow ,meybe cause the problem. this shadow param is null.

Hi. Could you share the whole layout xml + the Pixelshot code?

At first it seemed to me that the problem was in the CardView, but actually a blank card is working fine.
The problem appears when I place RecyclerView inside the card.

`

    <androidx.cardview.widget.CardView
            android:id="@+id/card_view"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:innerRadius="0dp"
            android:shape="ring"
            app:cardElevation="0dp"
            app:cardCornerRadius="75dp">

        <FrameLayout
                android:layout_width="150dp"
                android:layout_height="150dp">

            <androidx.recyclerview.widget.RecyclerView
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:overScrollMode="never"
                    android:clickable="false"
                    android:focusable="false"
                    android:id="@+id/recycler_view"/>
            
        </FrameLayout>

    </androidx.cardview.widget.CardView>

`

Using library like this: PixelShot.of(root_view).toPNG().save()

How it is on screen:
Screenshot_2019-08-20-14-17-56-039_color pallete republic from image generator

How is is on screenshot:
1566298966038

@letscoder I will take a look at it here in the weekend

Hi @letscoder. Have you managed to fix it?

No, it seems internal problem with canvas rendering, so it doesn't work even ouside of the library.I've just used Glide circle filter to resolve this.