cancel
Showing results for 
Search instead for 
Did you mean: 

TextView in MatrixLayout - can't control width

former_member185943
Participant
0 Kudos

Hi, all,

I am having cca 100 TextView elements inside a MatrixLayout form, each in front of an InputField. They are here instead of Labels, because Labels can't wrap text and some of them are really long.

I have problems. I am trying to control their width programatically (eg set MatrixHeadData.width = '300px'), but this is ignored. They stay narrow and wrap in 6 lines (which is too much).

However, I noticed strange behaviour. I placed a dummy button on a view, doing nothing except triggering roundtrip by a bear fact that it has an action. Whenever I click it, the TextViews grow wider. After cca 7 clicks of growing little by little, they stop growing at some random width (not the one which I am setting). It seems like a bug.

Does anyone have idea?

Thanks!

KR,

Igor

Accepted Solutions (1)

Accepted Solutions (1)

amy_king
Active Contributor
0 Kudos

Hi Igor,

The Label UI element can wrap-- it has a wrapping property that you can set to true or false.

Cheers,

Amy

Answers (3)

Answers (3)

former_member185943
Participant
0 Kudos

Hi,

Thank you all for your valuable inputs - they are all good ideas on how to try to work this problem around.

@Amy: Yes, I saw this property, but I wasn't able to make it actually wrap. It was simply ignored in my labels. Moreover, in my case Label has another problem: length limit. I believe it is 136 characters (not sure is this exact, but roughly).

Unfortunately, I can't test this now since it was a short-term assignment which has finished. Sorry for delayed reply.

Igor

yury_sichov
Active Contributor
0 Kudos

Place TextView elements in Transparent Container with fixed width.

ramakrishnappa
Active Contributor
0 Kudos

Hi Igor,

As suggested by Amy, there is wrapping option for labels as well.

If you need semantic coloring for labels, you can still consider textview.

Controlling alignment of textveiw elements as labels for input fields could a tricky job here.

You need to put every pair of textview and inputfield inside a transparent container i.e. for each row/line, a transparent container to be created. So that you can control the width / alignment easily.

Hope this helps you.

Regards,

Rama