I’m developing an application in Kotlin. The text inside my ComboBox is not visible if I don’t assign a color, and it is also not visible in dark mode. Is there a simple solution for this without setting a color?
<code>@Composable // Composable function // Composable fonksiyon // UnitConverter function // UnitConverter fonksiyonu
fun UnitConverter(
name: String,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.fillMaxSize(), // Fill the entire screen (width and height) // Ekranın tamamını doldur (genişlik ve yükseklik)
verticalArrangement = Arrangement.Center, // Center the content vertically,
horizontalAlignment = Alignment.CenterHorizontally, // Center the content horizontally // İçeriği yatay olarak ortalayın
// İçeriği dikey olarak ortalayın
) {
Text("Unit Converter") // Text // Metin
Spacer(modifier = Modifier.height(16.dp))
OutlinedTextField(value = "", onValueChange = {
// TODO
})
Spacer(modifier = Modifier.height(16.dp))
Row {
Box {
Button(onClick = { /*TODO*/ }) {
// Button // Düğme
Text("Select")
Icon(Icons.Default.ArrowDropDown, contentDescription = "Arrow Down")
}
DropdownMenu(expanded = true, onDismissRequest = { /*TODO*/ }) {
DropdownMenuItem(text = { Text("Centimeters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Meters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Feet", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("MiliMeters", color = Color.Black) }, onClick = { /*TODO*/ })
}
}
Spacer(modifier = Modifier.height(16.dp))
Box {
Button(onClick = { /*TODO*/ }) {
Text("Convert")
Icon(Icons.Default.ArrowDropDown, contentDescription = "Arrow Down")
}
DropdownMenu(expanded = true, onDismissRequest = { /*TODO*/ }) {
DropdownMenuItem(text = { "ss" }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Meters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Feet", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("MiliMeters", color = Color.Black) }, onClick = { /*TODO*/ })
}
}
}
Spacer(modifier = Modifier.height(16.dp))
Text("Result")
}
}
</code>
<code>@Composable // Composable function // Composable fonksiyon // UnitConverter function // UnitConverter fonksiyonu
fun UnitConverter(
name: String,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.fillMaxSize(), // Fill the entire screen (width and height) // Ekranın tamamını doldur (genişlik ve yükseklik)
verticalArrangement = Arrangement.Center, // Center the content vertically,
horizontalAlignment = Alignment.CenterHorizontally, // Center the content horizontally // İçeriği yatay olarak ortalayın
// İçeriği dikey olarak ortalayın
) {
Text("Unit Converter") // Text // Metin
Spacer(modifier = Modifier.height(16.dp))
OutlinedTextField(value = "", onValueChange = {
// TODO
})
Spacer(modifier = Modifier.height(16.dp))
Row {
Box {
Button(onClick = { /*TODO*/ }) {
// Button // Düğme
Text("Select")
Icon(Icons.Default.ArrowDropDown, contentDescription = "Arrow Down")
}
DropdownMenu(expanded = true, onDismissRequest = { /*TODO*/ }) {
DropdownMenuItem(text = { Text("Centimeters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Meters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Feet", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("MiliMeters", color = Color.Black) }, onClick = { /*TODO*/ })
}
}
Spacer(modifier = Modifier.height(16.dp))
Box {
Button(onClick = { /*TODO*/ }) {
Text("Convert")
Icon(Icons.Default.ArrowDropDown, contentDescription = "Arrow Down")
}
DropdownMenu(expanded = true, onDismissRequest = { /*TODO*/ }) {
DropdownMenuItem(text = { "ss" }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Meters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Feet", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("MiliMeters", color = Color.Black) }, onClick = { /*TODO*/ })
}
}
}
Spacer(modifier = Modifier.height(16.dp))
Text("Result")
}
}
</code>
@Composable // Composable function // Composable fonksiyon // UnitConverter function // UnitConverter fonksiyonu
fun UnitConverter(
name: String,
modifier: Modifier = Modifier,
) {
Column(
modifier = modifier.fillMaxSize(), // Fill the entire screen (width and height) // Ekranın tamamını doldur (genişlik ve yükseklik)
verticalArrangement = Arrangement.Center, // Center the content vertically,
horizontalAlignment = Alignment.CenterHorizontally, // Center the content horizontally // İçeriği yatay olarak ortalayın
// İçeriği dikey olarak ortalayın
) {
Text("Unit Converter") // Text // Metin
Spacer(modifier = Modifier.height(16.dp))
OutlinedTextField(value = "", onValueChange = {
// TODO
})
Spacer(modifier = Modifier.height(16.dp))
Row {
Box {
Button(onClick = { /*TODO*/ }) {
// Button // Düğme
Text("Select")
Icon(Icons.Default.ArrowDropDown, contentDescription = "Arrow Down")
}
DropdownMenu(expanded = true, onDismissRequest = { /*TODO*/ }) {
DropdownMenuItem(text = { Text("Centimeters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Meters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Feet", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("MiliMeters", color = Color.Black) }, onClick = { /*TODO*/ })
}
}
Spacer(modifier = Modifier.height(16.dp))
Box {
Button(onClick = { /*TODO*/ }) {
Text("Convert")
Icon(Icons.Default.ArrowDropDown, contentDescription = "Arrow Down")
}
DropdownMenu(expanded = true, onDismissRequest = { /*TODO*/ }) {
DropdownMenuItem(text = { "ss" }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Meters", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("Feet", color = Color.Black) }, onClick = { /*TODO*/ })
DropdownMenuItem(text = { Text("MiliMeters", color = Color.Black) }, onClick = { /*TODO*/ })
}
}
}
Spacer(modifier = Modifier.height(16.dp))
Text("Result")
}
}
Text default color black
New contributor
Yiğit is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1