
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
Log.d("init", "onCreate") | |
super.onCreate(savedInstanceState) | |
setContent { | |
DefaultTheme { | |
// A surface container using the 'background' color from the theme | |
Surface( | |
modifier = Modifier.wrapContentSize(), | |
color = MaterialTheme.colorScheme.background | |
) { | |
SimpleFilledTextFieldSample() | |
} | |
} | |
} | |
} | |
} | |
@Composable | |
fun Greeting(name: String, modifier: Modifier = Modifier) { | |
Text( | |
text = "Hello $name!", | |
modifier = modifier | |
) | |
} | |
@Composable | |
fun SimpleFilledTextFieldSample() { | |
var count by remember { mutableStateOf(0) } | |
Button(onClick = { | |
count++ | |
}, | |
modifier = | |
Modifier.width(200.dp).height(100.dp) | |
) { | |
Log.d("Count", count.toString()) | |
Text("Count: $count") | |
} | |
} | |
@Preview(showBackground = true) | |
@Composable | |
fun GreetingPreview() { | |
DefaultTheme { | |
Surface( | |
modifier = Modifier.wrapContentSize(), | |
color = MaterialTheme.colorScheme.background | |
) { | |
SimpleFilledTextFieldSample() | |
} | |
} | |
} |