'remove padding from shadow blur on 9 patch image

i've created shadow using this 9 patch generator link because i need the offset, blur, and the round option

https://inloop.github.io/shadow4android/

9 patch shadow image

but it looks like created padding around 9 patch because of the shadow blur so the result when im using the image on android studio look like this layout with 9 patch background

i want my 9 patch become background shadow for my linearlayout without padding around it, how do i achieve this?

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingHorizontal="26dp"
    android:paddingVertical="22dp"
    tools:context=".TeamDetailActivity"
    android:id="@+id/profile_container"
    android:orientation="vertical">

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@drawable/pls"
                android:orientation="vertical">

                    <ImageView
                        android:layout_width="50dp"
                        android:layout_height="wrap_content"
                        android:adjustViewBounds="true"
                        android:scaleType="fitXY"
                        android:src="@drawable/psg" />

            </LinearLayout>

</LinearLayout> 


Solution 1:[1]

1.First create a xml file (example: border_shadow.xml) in "drawable" folder and copy the below code into it.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <item>
        <shape>
            <!-- set the shadow color here -->
            <stroke
                android:width="2dp"
                android:color="#7000" />
            <!-- setting the thickness of shadow (positive value will give shadow on that side) -->
            <padding
                android:bottom="2dp"
                android:left="2dp"
                android:right="-1dp"
                android:top="-1dp" />

            <corners android:radius="3dp" />
        </shape>
    </item>
    <item>
        <shape>
            <solid android:color="#fff" />
            <corners android:radius="3dp" />
        </shape>
    </item>
</layer-list>

Now set as Background of Linear Layout:

Solution 2:[2]

There is an option to remove paddings in the image created by the tool you mentioned

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nitish
Solution 2 Faraz Ahmed