Where is Text alignment option for text view in the latest version of Android Studio?
Where is Text alignment option for text view in the latest version of Android Studio?
I'm a newbie here and trying to dive in into android development with android studio.
I was watching a video on udemy on their intro to android development tutorial and I noticed that the android studio (version 3.1.3 running on mac OS High Sierra 10.13.6) does not have any textAlignment option for textView.
Below are some screenshots to show you exactly what I mean:
So yeah, I'm really confused about this and I've been trying to google any answer for this to no avail. Isn't the option supposed to be there? Forgive me if it turns out that I made a stupid mistake or something, I'm a total beginner when it comes to this, just trying to learn.
Any help will be greatly appreciated!
Kind regards,
2 Answers
2
textAlignment
was introduced in api level 17, so you can not see it there, if your minSdkVersion
is greater than 17.
textAlignment
minSdkVersion
You can specify gravity
in TextView
. If you use textAlignment = "textEnd"
then you have to specify gravity
also.
gravity
TextView
textAlignment = "textEnd"
gravity
So i suggest you use just gravity
for same purpose. If you still want enter textAlignment
then you can type in text editor of xml. There you will see suggestion of textAlignment
.
gravity
textAlignment
textAlignment
Yes!, exactly. You got it. Upvote & mark right if this helped you.
– Khemraj
8 mins ago
Yup for sure mate, damn I still have lots to learn
– zer0_reaper
4 mins ago
I am using android 3.1.3 on macOS Sierra 10.12.6
I don't know about UI options. But, you definitely can add it in the XML like,
<TextView
android:layout_width="wrap_content"
android:layout_height="55dp"
android:textAlignment="center" />
You are editing it in the design view right now. Switch it to the text part of activity_main.xml.
Hope this works for you.
Ah right right I see, thanks for that. I'll definitely need to learn more about this activity_main.xml
– zer0_reaper
9 mins ago
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
Hi mate, OOHHHH, I tried to close the project, started a new project with min API level of 23 and the textAlignent option is there! Right right I see, so it's just the project configuration. Cheers man! Thanks a bunch
– zer0_reaper
10 mins ago