Skip to content

Add UIText to UIScrollableVerticalLayout #147

@ValentinKalchev

Description

@ValentinKalchev

I have a problem adding UIText to UIScrollableVerticalLayout and scrolling it. I assign the parentUI to be my scrollable variable - text is shown but it doesn't scroll. What is the best way to implement this? There is an example with UITouchableSprite and buttons but that doesn't help as UIText is not touchable and therefore it never calls onTouchMoved() in UIScrollableVerticalLayout class.

scrollable = new UIScrollableVerticalLayout(10);
scrollable.alignMode = UIAbstractContainer.UIContainerAlignMode.Left;
scrollable.position = new Vector3(Screen.width*(CameraNavigation.mainCameraNormalizedViewPortRect.width + 0.05f), -50, 0 );

//Reading data from resource .txt and assigning it to lines variable

for(int i = 0; i<lines.Length;i++)
{
var countryInfoText = textType.addTextInstance(lines[i],Screen.width* 0.05f,textSize, 0.4f, -1,Color.white,UITextAlignMode.Center, UITextVerticalAlignMode.Middle );

    textSize = textSize + (textType.sizeForText(lines[i]).y * 0.3f) ;
countryInfoText.parentUIObject = scrollable;
    ...

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions