Android Question Label Orientation

adriano.freitas

Active Member
My app works exclusively in portrait mode. I have a panel in which there is a Scrollview2D and in this a label. Depending on the situation, I need Scrollview2D and the label to behave as if the orientation had changed, however, I need everything to stay as it was and only these two objects are affected. Is this possible? If yes, how to do it?

If there was the possibility of this happening with a text box, it would be great, but the label alone would help a lot!

Thanks!
 

adriano.freitas

Active Member
You can rotate any view, or panel with all its inner views, with B4XView.Rotate = 90
Thank you for the response.

The application in question does not yet use XPages. It was made at the time using only the B4A. As it is complex and has several features that would need to be rewritten or adapted to run on XPages, I haven't been able to find the time for this yet. Is there any way in the case of pure B4A? If so, is there an example I can see?

Thank you very much!
 
Upvote 0

adriano.freitas

Active Member
There is no such thing "pure B4A".

Panel.As(B4XView).Rotate = 90

I managed to solve it following your idea, as follows:

Example:
    Private Painel As B4XView
    Painel=ScrollTextoDialogoTextoLongo ' LabelTextoDialogoTextoLongo
    Painel.Rotation = 90

However, as per the attached image, the panel inside the ScrollView2D that I rotated is positioned wrong within the Panel that contains it, even though I reset Top and Left to 0. It is only positioned correctly if I use Top = -350 and Left = -360 , which didn't make sense to me. I would like to understand what I should do so that the object correctly occupies the panel that contains it, filling it completely. I'm afraid that using these negative coordinates in a fixed way will not apply to other screen sizes.

Can you guide me?

Thanks!

PS: I set the object's background color to red just to make it easier to see its position.
 

Attachments

  • TreeBase Exemplo.jpg
    TreeBase Exemplo.jpg
    353.6 KB · Views: 89
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Can you guide me?
- It is always a big mistake NOT to upload a small project showing the Issue
- Such a Screenshot does not help either
- Others usually can help MUCH BETTER if you do upload a testproject ;-)
 
Last edited:
Upvote 0

adriano.freitas

Active Member
My apologies.

It turns out that the application is extremely complex and very large. But I understand and I made a small example of what happens. It uses the ScrollView2D library. Note that after rotating the control, it is difficult to reposition it as it was, keeping only the rotated content. As much as I try to use top, left, width and height to adjust it as it was, I can't understand what happens with the coordinates, as it doesn't seem logical to me.

In practice, I want the control to stay in the same location and with the same dimensions, only its content is rotated. But when trying to reposition and resize after rotating, I get confused because I can't. I can only use negative coordinates (in the case of my app) or some number based on trial and error, but I think this works for my device but may cause problems on other screen sizes. I wanted to understand what happens to do everything correctly and not improvised!

Thank you very much!
 

Attachments

  • Example.rar
    15.7 KB · Views: 97
Upvote 0
Top