MainActivity.kt
package com.cfsuman.jetpackcompose
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
GetScaffold()
}
}
@Composable
fun GetScaffold(){
Scaffold(
topBar = {TopAppBar(
title = {Text(
"Compose - Row Overflow",
color = Color.White)},
backgroundColor = Color(0xFF58427C)) },
content = {MainContent()},
backgroundColor = Color(0xFFEDEAE0)
)
}
@Composable
fun MainContent(){
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp),
verticalArrangement = Arrangement.SpaceEvenly
) {
Row(
modifier = Modifier
.height(150.dp)
.fillMaxWidth()
.background(Color(0xFFC0E8D5))
.wrapContentSize(
unbounded = false,
align = Alignment.Center
)
.padding(12.dp)
) {
Box(
Modifier
.background(Color(0xFFCD7F32))
.height(500.dp)
.width(600.dp)
){
Text(
text = "Unbounded False"
)
}
}
Row(
modifier = Modifier
.height(150.dp)
.fillMaxWidth()
.background(Color(0xFFC0E8D5))
.wrapContentSize(unbounded = true)
.padding(12.dp)
) {
Box(
Modifier
.background(Color(0xFFFF55A3))
.fillMaxWidth()
.height(175.dp)
){
Text(
text = "Unbounded True"
)
}
}
Row(
modifier = Modifier
.height(150.dp)
.fillMaxWidth()
.background(Color(0xFFC0E8D5))
.wrapContentSize(
unbounded = true
)
.padding(12.dp)
) {
Box(
Modifier
.background(Color(0xFFDE5D83))
.height(100.dp)
.width(500.dp)
){
Text(
text = "Unbounded True"
)
}
}
}
}
@Preview
@Composable
fun ComposablePreview(){
//GetScaffold()
}
}
- jetpack compose - Row gravity
- jetpack compose - Row background
- jetpack compose - Row space between
- jetpack compose - Row alignment
- jetpack compose - Kotlinx serialization decode josn element
- jetpack compose - How to use kotlin flow
- jetpack compose - Random number flow
- jetpack compose - flowOf flow builder
- jetpack compose - Convert list to flow
- jetpack compose - Count down flow
- jetpack compose - Count up flow by ViewModel
- jetpack compose flow - Room add remove update
- jetpack compose flow - Room implement search
- jetpack compose - ViewModel Room delete clear data
- compose glance - How to create app widget