有没有办法在 jetpack compose 中将 TextField 密码点图标增加得更大?

New*_*zal 2 textfield kotlin android-jetpack-compose android-compose-textfield

我正在做密码文本字段,我想在用户输入时做密码点,但默认密码点图标很小,我想要更大的文本字段密码点。我怎样才能做到这一点 ?

听到的是我的 TextFiedl 代码 ->

  var text by remember { mutableStateOf("") }
  var isFocused by remember { mutableStateOf(false) }
  val color = if (isFocused || text.isNotEmpty()) DefaultDYTColor else Color.Transparent

     TextField(
            modifier = Modifier
                .fillMaxWidth()
                .border(
                    width = if (isFocused) 1.dp else 0.dp,
                    color = color,
                    shape = RoundedCornerShape(25.dp)
                )
                .clip(RoundedCornerShape(25.dp))
                .onFocusChanged {
                    isFocused = it.isFocused
                },
            value = text,
            onValueChange = { newText ->
                text = newText
            },
            visualTransformation = PasswordVisualTransformation(),
            leadingIcon = {
                Image(painter = painterResource(id = R.drawable.ic_password), contentDescription = "" )
            },
            colors = TextFieldDefaults.textFieldColors(
                cursorColor = MaterialTheme.colors.DYTThemeColor,
                disabledTextColor = Color.Transparent,
                focusedIndicatorColor = Color.Transparent,
                unfocusedIndicatorColor = Color.Transparent,
                disabledIndicatorColor = Color.Transparent
            )
        )
Run Code Online (Sandbox Code Playgroud)

小智 5

默认掩码PasswordVisualTransformation是项目符号点\xe2\x80\xa2\\u2022代码样式。您可以通过将掩码声明为构造函数参数来将其替换为任何 unicode 字符。

\n

例如,PasswordVisualTransformation(mask = '\\u25CF')将应用黑色圆圈\xe2\x97\x8f作为遮罩。

\n
TextField(\n    ...\n    visualTransformation = PasswordVisualTransformation(mask = '\\u25CF'),\n    ...\n)\n
Run Code Online (Sandbox Code Playgroud)\n

快乐编码!

\n