I'm trying to create a drawable shape with stroke for my popup layout background.

I tried to play around with radius but didn't get the desired result.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<stroke android:color="?colorSecondary" android:width="1dp"/>
<solid android:color="?colorSurface"/>
<corners
android:topLeftRadius="@dimen/card_corner_radius"
android:topRightRadius="@dimen/card_corner_radius"
android:bottomLeftRadius="@dimen/card_corner_radius"
android:bottomRightRadius="@dimen/card_corner_radius" />
</shape>
I tried with the canvas but cannot achieve second picture

Why can't you simply use the graphics that you posted as a PNG file? Other options follow.
You could decompose your drawing to its components and build a LayerList drawable from the components. For instance, your first image looks like is is composed of two horizontal lines and arcs of ovals at either end. Four drawables, each representing one of these figures and stacked would produce your first image. It would be similar for the second image.
Since you already have the image you want, you could paste it into a vector graphic editing program such as InkScape, export the SVG file and import the SVG file into Android Studio (File->New->Vector Asset and select local SVG file). I did this with your second image and came up with the following:
Which looks like this when displayed in an ImageView:
The image can be scaled and accurately reflect the original image at any size screen. You can use any graphics editor that can produce an SVG file.