Advertisement
onixst

Untitled

Sep 26th, 2024
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.65 KB | None | 0 0
  1. import androidx.compose.foundation.*
  2. import androidx.compose.foundation.layout.*
  3. import androidx.compose.material3.Text
  4. import androidx.compose.material3.TextField
  5. import androidx.compose.runtime.*
  6. import androidx.compose.ui.Modifier
  7. import androidx.compose.ui.graphics.Color
  8. import androidx.compose.ui.tooling.preview.Preview
  9. import androidx.compose.ui.unit.dp
  10.  
  11. @Preview
  12. @Composable
  13. fun Example() {
  14. var text by remember { mutableStateOf("") }
  15. val innerPadding = 16.dp
  16. // Not needed if you set this up in style or manifest
  17. // (LocalContext.current as Activity)
  18. // .window
  19. // .setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING)
  20. Column(
  21. Modifier
  22. .fillMaxSize()
  23. .systemBarsPadding()
  24. .imePadding()
  25. .background(Color.Yellow)
  26. ) {
  27. Text(
  28. text = "Title",
  29. modifier = Modifier
  30. .fillMaxWidth()
  31. .height(50.dp)
  32. .background(Color.Cyan)
  33. )
  34. Column(
  35. Modifier
  36. .fillMaxSize()
  37. .padding(innerPadding)
  38. ) {
  39. TextField(
  40. value = text,
  41. onValueChange = { text = it },
  42. modifier = Modifier
  43. .fillMaxWidth()
  44. .weight(1f)
  45. )
  46. Spacer(Modifier.height(innerPadding))
  47. Text(
  48. text = "Buttons",
  49. Modifier
  50. .fillMaxWidth()
  51. .height(50.dp)
  52. .background(Color.Red)
  53. )
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement