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.foundation.layout.Column
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
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MainContent()
}
}
@Composable
fun MainContent(){
Column(
Modifier
.background(Color(0xFFEDEAE0))
.fillMaxSize()
.padding(16.dp)
) {
Box(
modifier = Modifier
.fillMaxWidth()
.background(Color(0XFF8DB600))
.weight(1F)
)
Box(
modifier = Modifier
.fillMaxWidth()
.background(Color(0XFFAB274F))
.weight(2F)
)
Box(
modifier = Modifier
.fillMaxWidth()
.background(Color(0XFF4B5320))
.weight(1F)
)
}
}
@Preview
@Composable
fun ComposablePreview(){
//MainContent()
}
}
- jetpack compose - How to use Text
- jetpack compose - Radio group example
- jetpack compose - How to use Floating Action Button
- jetpack compose - How to use IconToggleButton
- jetpack compose - How to use Column layout
- jetpack compose - How to use Slider
- jetpack compose - How to use Switch
- jetpack compose - LinearProgressIndicator example
- jetpack compose - CircularProgressIndicator example
- jetpack compose - Navigation drawer example
- jetpack compose - How to use Scaffold
- jetpack compose - Dragging
- jetpack compose - Multiple draggable objects
- jetpack compose - Swiping
- jetpack compose - Panning zooming rotating