Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import androidx.compose.foundation.*
- import androidx.compose.foundation.layout.*
- import androidx.compose.material3.Text
- import androidx.compose.material3.TextField
- import androidx.compose.runtime.*
- import androidx.compose.ui.Modifier
- import androidx.compose.ui.graphics.Color
- import androidx.compose.ui.tooling.preview.Preview
- import androidx.compose.ui.unit.dp
- @Preview
- @Composable
- fun Example() {
- var text by remember { mutableStateOf("") }
- val innerPadding = 16.dp
- // Not needed if you set this up in style or manifest
- // (LocalContext.current as Activity)
- // .window
- // .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
- Column(
- Modifier
- .fillMaxSize()
- .systemBarsPadding()
- .imePadding()
- .background(Color.Yellow)
- ) {
- Text(
- text = "Title",
- modifier = Modifier
- .fillMaxWidth()
- .height(50.dp)
- .background(Color.Cyan)
- )
- Column(
- Modifier
- .fillMaxSize()
- .padding(innerPadding)
- ) {
- TextField(
- value = text,
- onValueChange = { text = it },
- modifier = Modifier
- .fillMaxWidth()
- .weight(1f)
- )
- Spacer(Modifier.height(innerPadding))
- Text(
- text = "Buttons",
- Modifier
- .fillMaxWidth()
- .height(50.dp)
- .background(Color.Red)
- )
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement