0% found this document useful (0 votes)
6 views2 pages

Code

The document contains an Android application code for a business card screen using Jetpack Compose. It defines a main activity that sets the content to a composable function displaying a profile image, name, job title, and contact information. The layout is structured with a background color and various spacing elements for visual appeal.

Uploaded by

hungabc2206
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Code

The document contains an Android application code for a business card screen using Jetpack Compose. It defines a main activity that sets the content to a composable function displaying a profile image, name, job title, and contact information. The layout is structured with a background color and various spacing elements for visual appeal.

Uploaded by

hungabc2206
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

package com.example.

rebc

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material3.*
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

class MainActivity : ComponentActivity() {


override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
BusinessCardScreen()
}
}
}

@Composable
fun BusinessCardScreen() {
Column(
modifier = Modifier
.fillMaxSize()
.background(Color(0xFFD2E2CB)), // Background color
horizontalAlignment = Alignment.CenterHorizontally
){
Spacer(modifier = Modifier.height(250.dp))

// Profile Image
Image(
painter = painterResource(id = R.drawable.android_logo),
contentDescription = "Profile Picture",
modifier = Modifier
.size(120.dp)
.clip(RectangleShape)
.background(Color(0xFF1D2352))
)

Spacer(modifier = Modifier.height(16.dp))

// Name
Text(
text = "Jennifer Doe",
fontSize = 32.sp,
textAlign = TextAlign.Center,
color = Color.Black
)

// Job Title
Text(
text = "Android Developer Extraordinaire",
fontSize = 16.sp,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center,
color = Color(0xFF296F2F),
modifier = Modifier.padding(top = 4.dp)
)

Spacer(modifier = Modifier.height(230.dp))

// Contact Info Section


ContactInfoRow(R.drawable.phone_ic, "+11 (123) 444 555 666")
ContactInfoRow(R.drawable.share_ic, "@AndroidDev")
ContactInfoRow(R.drawable.email_ic, "[email protected]")
}
}

@Composable
fun ContactInfoRow(iconResId: Int, text: String) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(horizontal = 100.dp, vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically
){
Image(
painter = painterResource(id = iconResId),
contentDescription = null,
modifier = Modifier.size(24.dp)
)
Spacer(modifier = Modifier.width(16.dp))
Text(text = text, fontSize = 16.sp, color = Color.Black)
}
}

You might also like