我有一个问题,我的StackLayout不会在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>
我花了好几个小时寻找问题,但却找不到。我对nativescript很新,所以可能就是问题。
这是我的包裹:
{
"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"
}
}
我运行android 4.4.2。
答案 0 :(得分:1)
这应该可行,至少它可以在我的设备上运行。当您遇到问题时,不要犹豫,创建游乐场,重现错误(here is one for your code)会更容易。请注意,仅当显示的内容多于屏幕大小时,ScrollView才会滚动,因此如果您的屏幕大于ScrollView内的内容,则不会看到任何滚动效果。
答案 1 :(得分:0)
我发现了问题。似乎我正在设定#34;#Content&#34;的高度。至&#34; 100%&#34;。愚蠢的错误,谢谢你的回应。