Ask Your Question
3

What is the method for applying a bottom border exclusively in Jetpack Compose?

asked 2022-04-25 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-10-26 11:00:00 +0000

ladyg gravatar image

To apply a bottom border exclusively in Jetpack Compose, use the Modifier.border() function with the following parameters:

  • width: The width of the border.
  • color: The color of the border.
  • shape: The shape of the border, which can be either RectangleShape or RoundedCornerShape.

To apply a bottom border, set the border modifier with BorderStroke to the View, with size parameter describing the width of the border:

Box(modifier = Modifier
    .height(100.dp)
    .width(100.dp)
    .border(border = BorderStroke(2.dp, Color.Red), shape = RectangleShape, shapeAppearance = null))

This will add a border with a width of 2dp and a red color to the bottom of the view.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-04-25 11:00:00 +0000

Seen: 11 times

Last updated: Oct 26 '22