fluuurp
fluuurp

Reputation: 11

nativescript scrollview android doesnt work

I have a problem that my StackLayout does not scroll in a scrollView.

<Page loaded="loaded" id="main">
<Page.actionBar>
    <ActionBar title="Register">
    </ActionBar>
</Page.actionBar>
<ScrollView orientation="vertical" id="scrollView">
    <StackLayout id="Content">
        <Label id="Lfname" text="First name: " />
        <TextField text="{{ fname }}" id="fname" hint="first name" />

        <Label text="Last name: " />
        <TextField text="{{ lname }}" id="lname" hint="last name" />

        <Label text="E-mail: " />
        <TextField text="{{ email }}" id="email" hint="email" />

        <Label text="Confirm E-mail: " />
        <TextField text="{{ emailConfirm }}" id="emailConfirm" hint="email" />

        <Label text="Password: "/>
        <TextField text="{{ password }}" id="password" secure="true"/>

        <Label text="Confirm Password: "/>
        <TextField text="{{ passwordConfirm }}" id="passwordConfirm" secure="true"/>

        <Button id="register" text="Register" tap="onRegister" class="confirm" />
        <Button id="login" text="Login" tap="onLogin" class="link"/>
    </StackLayout>
</ScrollView>
</Page>

I've spend hours looking for the problem, but can't find it. I'm pretty new to nativescript so that might be the problem.

Here are my packages:

{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
    "id": "org.nativescript.foodFetish",
    "tns-android": {
        "version": "4.0.1"
    }
},
"dependencies": {
    "nativescript-theme-core": "~1.0.4",
    "tns-core-modules": "^4.1.0"
},
"devDependencies": {
    "babel-traverse": "^6.26.0",
    "babel-types": "^6.26.0",
    "babylon": "6.4.5",
    "lazy": "1.0.11"
}
}

And I run android 4.4.2.

Upvotes: 0

Views: 862

Answers (2)

fluuurp
fluuurp

Reputation: 11

I found the problem. It seemed that i was setting the height of "#Content" to "100%". Stupid mistake, thanks for the response.

Upvotes: 1

Florian Thuin
Florian Thuin

Reputation: 950

This should work, at least it works on my devices. Do not hesitate to create playgrounds when you have a problem, it's way easier to reproduce the bug (here is one for your code). Note that ScrollView scrolls only if there is more content to display than the size of your screen, so if your screen is bigger than the content inside the ScrollView, you won't see any scroll effect.

Upvotes: 1

Related Questions