hello how to set drawable to button as background
# compose
n
hello how to set drawable to button as background
a
Hi! Try adding modifier with
.paint
field
Copy code
Button(modifier = Modifier              .paint(painterResource(id = R.drawable.your_drawable_resource)),
            onClick = { }
        ) {
        }
👍 1
n
@Anastasia Rozovskaya how to Enable and disable Button according to the text in EditText
a
one way to do this is to create a boolean field like
isEnabled
and pass it to
enabled
field in
Button()
composable function. Then in your code in place of
isEnabled
pass your condition.
n
@Anastasia Rozovskaya suppose i have one edittext and one button if edittext is empty then need to disable button or else enable button
a
this is an example if you create your wrapper of button. in case you use just Button as it is, pass the condition strait to enabled. field
n
okay
a
yeah, you’ll cover this case with what I explained