MainActivity.kt
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
DefaultTheme {
GraphAppMain()
}
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun GraphAppMain(){
val navItems = listOf(
NavigationItem("그래프1", Icons.Default.AddCircle, "tab1"),
NavigationItem("그래프2", Icons.Default.AddCircle, "tab2"),
NavigationItem("그래프3", Icons.Default.AddCircle, "tab3")
)
Scaffold(
bottomBar = {
BottomAppBar {
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceAround
) {
navItems.forEach { nav ->
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
imageVector = nav.icon,
contentDescription = nav.name
)
Text(
text = nav.name
)
}
}
}
}
}
) { paddingValues ->
Box(
modifier = Modifier.padding(paddingValues)
) {
}
}
}
data class NavigationItem(
val name : String,
val icon : ImageVector,
val route : String
)
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
DefaultTheme {
GraphAppMain()
}
}
Graph1.kt
@Composable
fun Graph1() {
Text(
text = "1",
fontSize = 30.sp
)
}
@Preview(showBackground = true)
@Composable
fun Graph1Preview() {
DefaultTheme {
Graph1()
}
}
Graph2.kt
@Composable
fun Graph2() {
Text(
text = "2",
fontSize = 30.sp
)
}
@Preview(showBackground = true)
@Composable
fun Graph2Preview() {
DefaultTheme {
Graph2()
}
}
Graph3.kt
@Composable
fun Graph3() {
Text(
text = "3",
fontSize = 30.sp
)
}
@Preview(showBackground = true)
@Composable
fun Graph3Preview() {
DefaultTheme {
Graph3()
}
}