textStyle = MaterialTheme.typography.body2,
option에 따른 중앙정렬/왼쪽정렬로 나누기 + textStyle 설정
OutlinedTextField(
value = text,
onValueChange = {
if(text.length <= limitLength){
onTextChanged(it)
}else{
onTextChanged(it.substring(0 until limitLength))
}
},
// label = { Text("Label") }, .align(Alignment.Center),
modifier = Modifier.fillMaxWidth(),
placeholder = {
if(textCenterAlignment)
Text(hint,
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Center,
fontFamily = notosanFontFamily,
fontWeight = FontWeight.Normal)
else
Text(hint,
modifier = Modifier.fillMaxWidth(),
textAlign = TextAlign.Start,
fontFamily = notosanFontFamily,
fontWeight = FontWeight.Normal)
},
singleLine = true,
textStyle = if(textCenterAlignment) subtitle1Center else vlmTypography.subtitle1,
shape = RoundedCornerShape(radius),
colors = TextFieldDefaults.outlinedTextFieldColors(
placeholderColor = ColorSomeGray,
cursorColor = Color.Black,
focusedBorderColor = ColorEditTextOutlinedUnfocused,
unfocusedBorderColor = ColorEditTextOutlinedUnfocused
)
)
Textstyle 조정
val subtitle1Center = TextStyle(
fontFamily = fonts,
fontWeight = FontWeight.W500,
lineHeight = 22.sp,
textAlign = TextAlign.Center
)
키보드 설정 : 숫자만 보이게 하기
keyboardOptions = KeyboardOptions.Default.copy(keyboardType = KeyboardType.Number),
글자수 제한하는 방법
val gatheringLocation =
if(getheringNetworkData.metaData.gatheringLocation.length > 25) "${getheringNetworkData.metaData.gatheringLocation.take(25)}..."
else getheringNetworkData.metaData.gatheringLocation
'Android Dev > Compose' 카테고리의 다른 글
compose - TextField indicator(underline) customizing (0) | 2021.12.08 |
---|---|
OutlinedTextField - trials (0) | 2021.12.07 |
Compose - Gradient Color Set (0) | 2021.12.07 |
activity/fragment에서 Compose 호출 (0) | 2021.12.06 |
Compose - LazyColumn Flickering Issue or non data(Firebase flow) 플리커링 혹은 데이터없음 문제해결 (0) | 2021.09.05 |