Closed hardikbhalodi closed 1 year ago
You can wrap your background image in InsetDrawable
i tried that way but its not applying! background set to whole while i have padding for qr code and inset for background drawable.
Is that the result you want?
![]() |
```kotlin createQrVectorOptions { background { drawable = ContextCompat.getDrawable( this@MainActivity, R.drawable.frame ) } } ``` |
![]() |
```kotlin createQrVectorOptions { background { drawable = InsetDrawable( ContextCompat.getDrawable( this@MainActivity, R.drawable.frame)!!, .1f ) } } ``` |
Its applying like first image, i wanted to achieve like second image which has options.setPadding(0.15) (i did gray background just to explain)
Why don't you just set code padding to 0 and add padding to the ImageView.
Btw, this drawable definitely works for the 2nd case
InsetDrawable(yourBackgroundImage, 0.15f)
I could add padding to the ImageView but it will apply to the view only and later when creating a drawable the padding will not be there in the drawable itself. Thanks for your reply and suggestions. I will check it out.
On Mon, Apr 3, 2023 at 9:46 PM Alexander Zhirkevich < @.***> wrote:
Why don't you just set code padding to 0 and add padding to the ImageView
— Reply to this email directly, view it on GitHub https://github.com/alexzhirkevich/custom-qr-generator/issues/25#issuecomment-1494613796, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFYHHUA5ZHI6Z7QON7QB4LW7LZV5ANCNFSM6AAAAAAWLO7DZA . You are receiving this because you authored the thread.Message ID: @.***>
Right now lib has feature options.setPadding() which apply only to the QrCodeDrawable but when set background image it apply to whole area. Can we have that feature so we can give desire padding/margin to the background image too?