I want to align my contact elements as in the picture but I don't want to use padding and spacer, because it will look different on different devices(mb Im wrong). So how can I get such an output of elements?
[This is what I want it to look like] (https://i.stack.imgur.com/L8GLZ.png)
Tryed using horizontalAlignment = Alignment.CenterHorizontall on the columb block and different horizontalAlignments on the rows but couldn't manage to get what I wanted(
@Composable
fun Greeting() {
loadLogo()
loadContactInfo()
}
@Composable
fun loadLogo(
fio: String = stringResource(R.string.FIO),
logo: Int = R.drawable.android_logo,
title: String = stringResource(R.string.title)
) {
Column(
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.padding(bottom = 100.dp)
) {
Image(
painter = painterResource(id = logo),
contentDescription = stringResource(R.string.logo_desc),
modifier = Modifier
.fillMaxWidth()
.padding(bottom = 8.dp)
.height(150.dp)
.width(150.dp)
)
Text(text = fio, fontSize = 32.sp, modifier = Modifier.padding(bottom = 4.dp))
Text(text = title, fontSize = 16.sp, color = Color.Green)
}
}
@Composable
fun loadContactInfo(
phoneNum: String = stringResource(R.string.my_phone_num),
TGLink: String = stringResource(R.string.telegram_link),
emailAddress: String = stringResource(R.string.email_adress)
) {
Column(
verticalArrangement = Arrangement.Bottom,
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth()
) {
Row() {
Icon(
imageVector = Icons.Default.Phone,
contentDescription = "Phone icon",
)
Text(text = phoneNum)
}
Spacer(modifier = Modifier.height(35.dp))
Row() {
Icon(
imageVector = Icons.Default.Share,
contentDescription = "Phone icon",
)
Text(text = TGLink)
}
Spacer(modifier = Modifier.height(35.dp))
Row(
modifier = Modifier
.padding(bottom = 45.dp)
) {
Icon(
imageVector = Icons.Default.Email,
contentDescription = "Phone icon",
)
Text(text = emailAddress)
}
}
}