Jetpack Compose 降低 TextField 的高度

时间:2021-05-25 03:31:38

标签: android android-jetpack-compose

我正在尝试设计一个高度降低的搜索栏,例如 Google 搜索栏。但输入文本也被裁剪占位符文本。

            TextField(
                value = searchText.value,
                singleLine = true,
                onValueChange = {
                    searchText.value = it
                },
                placeholder = { //placeholder text is also getting cropped
                   
                        Text(
                            text = "Search",
                            fontSize = 20.sp,
                        )
                    
                },
                textStyle = TextStyle(fontSize = 20.sp), // input text is getting cropped
                modifier = Modifier
                    .fillMaxWidth()
                    .padding(vertical = 10.dp)
                    .height(45.dp), // Here I have decreased the height
                shape = RoundedCornerShape(22.dp),
                )

我的输入文本和占位符文本被裁剪了 50%。 如何解决?

Search Field

0 个答案:

没有答案