강의

멘토링

로드맵

인프런 커뮤니티 질문&답변

shafeel2님의 프로필 이미지
shafeel2

작성한 질문수

[LV1] Jetpack Compose - UI 연습하기

Column + Row (명함 만들기)

horizontalArrangement verticalAlignment 관련질문입니다

작성

·

273

·

수정됨

0

 

1000.png

위의 코드중에서 아래

horizontalArrangement = Arrangement.SpaceEvenly, verticalAlignment = Alignment.CenterVertically,

이부분 코드를 추가해도 여전히 글자들은 화면상단 좌측에 정렬되는 군요 ...

 

답변 3

0

개복치개발자님의 프로필 이미지
개복치개발자
지식공유자

imagerow의 크기를 지정해주지 않았기 때문입니다.

위의코드를 추가해주시면

잘 나옵니다.

image

 

 

shafeel2님의 프로필 이미지
shafeel2
질문자

아 그렇군요

다시한번 강사님의 노고에 감사드리며

늘 건강하시고 부자되세요 ~!

 

 

0

shafeel2님의 프로필 이미지
shafeel2
질문자

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.dongguntechnology.compose_image.ui.theme.Compose_ImageTheme
import coil.compose.AsyncImage

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            Compose_ImageTheme {
                RowTest()
            }
        }
    }
}

@Composable
fun RowTest(){
    Row(
        modifier = Modifier
            .background(Color.Gray),
        horizontalArrangement = Arrangement.SpaceEvenly,
        verticalAlignment = Alignment.CenterVertically,
    ) {
        Text(
            "DongGun",
            fontSize = 30.sp,
            style = TextStyle(
                background = Color.Blue
            ),
        )
        Text(
            " ",
            fontSize = 30.sp,
            style = TextStyle(
                background = Color.Red
            ),
        )
        Text(
            "Technology",
            fontSize = 30.sp,
            style = TextStyle(
                background = Color.Green
            ),
        )
    }
}

 이상 전체코드입니다

0

개복치개발자님의 프로필 이미지
개복치개발자
지식공유자

코드를 복사해서 공유해주시면 살펴볼게요~

shafeel2님의 프로필 이미지
shafeel2

작성한 질문수

질문하기