https://kotlinlang.org logo
#compose
Title
# compose
c

Christian

10/14/2020, 8:02 AM
Hi everyone, does anybody knew how to set gravity or align text to
end
? basically, cursor starts from the right using
BaseTextField
j

jim

10/14/2020, 5:39 PM
cc @Siyamed
❤️ 1
s

Siyamed

10/14/2020, 5:39 PM
it is TextAlign
1
why do you want cursor to start from right?
😅 1
is it because of the language? do you want to move the cursor to end?
1
👆 1
c

Christian

10/15/2020, 2:24 AM
Hey @jim Thanks for tagging the right person! Hey @Siyamed, Yes! basically I want to start from the right to left, not specifically because of the language but it's the requirement. Like how I did on xml, I just set
textAlignment
to
viewEnd
@Siyamed, I believe
TextAlign
is only applicable on
Text
but not on
BaseTextField
s

Siyamed

10/15/2020, 3:07 AM
Got it. Can you please create a ticket about it? I would appreciate if you can describe the use case as well (in the ticket)
1
c

Christian

10/15/2020, 3:12 AM
I already had created it yesterday! Here is the link https://issuetracker.google.com/170785134. Let me know if its all the use cases you need. Thank you! 🙏 🙇
Hey @Siyamed I got it! I just want to put it out here for anyone who will encounter next! Thank you
Copy code
Column(with(ColumnScope) {
    Modifier.weight(1f)
}
) {
    BaseTextField(
        textStyle = TextStyle(textAlign = TextAlign.End),
        textColor = textColor,
        cursorColor = textColor,
        value = textState,
        onValueChange = {
            textState = it
        },
        modifier = Modifier.background(textField)
            .height(100.dp)
            .fillMaxWidth()
            .wrapContentSize(Alignment.BottomEnd)
    )
}
🙏 1