Jump to content

Android studio Jetpack Compose image doesn't fill box

Hi! So I have a column counting some elements and it contains a box within a box and an image inside that box, however once the image got in the box, it got smaller and if I make the box bigger the image actually gradually becomes its normal size but I don't get why it wouldn't do it now, there is enough space, why doesn't it fill the box, there is no padding that should affect it. I am sharing the code snippet and I am ignoring the other elements except the main box, because I hope they don't affect it otherwise that just turns into a mess. So please tell me you have the solution. I have wasted hours on this and I want to continue so I am leaving it to you.

 

 Box(
            modifier.padding(125.dp,50.dp,0.dp,0.dp)
               // .fillMaxWidth()
               // .weight(1f)
        ) {

            Box(
                modifier
                    .background(Color.White, shape = RoundedCornerShape(5.dp))
                    .height(130.dp)
                    .width(150.dp),
                contentAlignment = Alignment.Center,
            ) {

                androidx.compose.foundation.Image(painter = painterResource(id = R.drawable.vinyl), contentDescription ="vinyl_logo_1",modifier.absoluteOffset(2.dp,0.dp) .fillMaxSize() )

            }

        }

I commented on these because they do nothing.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×