How to align text at the center

Whenever I open the odk form on my phone, all the headings (text) appear on the far-left side of the phone while I want the text to appear in the centre of the phone. Is there a way to align text at the middle of the ODK?

U̶n̶f̶o̶r̶t̶u̶n̶a̶t̶e̶l̶y̶,̶ ̶I̶ ̶d̶o̶n̶'̶t̶ ̶t̶h̶i̶n̶k̶ ̶t̶h̶a̶t̶ ̶i̶s̶ ̶p̶o̶s̶s̶i̶b̶l̶e̶.̶ [EDIT: see @Grzesiek2010 's answer below]

The available styling options are described in https://docs.getodk.org/form-styling/.

It is possible. Here is a sample form:
centerText.xlsx (6.1 KB)

However there are some limitations:

  • we don't support styling groups: https://github.com/getodk/collect/issues/3433
  • the centered text will be centered horizontally but not vertically (it's more a bug in one of Android's classes but we can handle it so I'll try to fix the bug soon)

Edit: I created a pull request to fix that extra space which is added when centering is used:

2 Likes

Thanks for sharing a solution, but it seems that it doesnt work with notes? is there a specific setting to style notes?

Hi @NWS_MEAL_Manager
We're glad you're here. When you get a chance, please introduce yourself on this forum thread. I'd also encourage you to add a real picture as your avatar because it helps build community!

It should work with notes as well:

what version of ODK Collect are you using? Could you attach your form?

hi @Grzesiek2010, thank you for your answers! sadly I tried for note and couldn't manage to do it:
this is my test form:
a7dJK3W4kzxFKJPrmF8PqD.xlsx (8.8 KB)
image

this is the result
image

my version:
906addf66af230735e501ad73a1269012fdd7a5a (v2023.3.1)

I read a post that this might be supported for odk, but not for enketo, is this right?

Hi @rmirabal
ODK Collect and Enketo are two different tools (the same purpose but completely separate). There are lots of things that might work well in Collect but not Enketo and the other way around. It seems like it's only about centering? Or maybe I'm missing something?

thank you, I am familiarizing, yes it is about centering, only format