导航在WinJS中未按预期工作(Navigation not working as expected in WinJS)
ELLO!
我有一个应用程序栏图标和点击事件 - 我添加了一个功能,其中包含以下代码:
function homePage() { WinJS.Navigation.navigate("/home/homePage.html"); }
现在我有两个文件 - homePage.html里面/ home /和js文件相同。
id下一页的html上有一个简单的按钮。
在homePage.js文件中,我有:
function () { "use strict"; WinJS.UI.Pages.define("/home/homePage.html", { ready: function (element, options) { var button = document.getElementById("NextPage"); button.addEventListener("click", GoToNextPage); } }); function GoToNextPage() { WinJS.Navigation.navigate("/default.html"); } })();
但当我点击应用程序栏图标 - 没有任何反应:(
所以我打算完成的是当有人点击default.html上的appbar图标时 - 用户切换到homePage.html(然后当我点击homePage按钮时 - 它会返回) - 但即使是初始页面传输也没有地点。
这是令人尴尬的问,但我不能只是折叠我的手,等待一些神奇的事情发生。 我一直在研究这个问题一小时 - 阅读视频和样本,但它根本不起作用。
会感激帮助 - 我无法弄清楚出了什么问题。 谢谢!
Ello!
I have an app bar icon and on the click event - I added a function which has the following code:
function homePage() { WinJS.Navigation.navigate("/home/homePage.html"); }
Now I have two files - homePage.html which is inside /home/ and the js file for the same.
There's a simple button on html of id NextPage.
While in the homePage.js file, I have:
function () { "use strict"; WinJS.UI.Pages.define("/home/homePage.html", { ready: function (element, options) { var button = document.getElementById("NextPage"); button.addEventListener("click", GoToNextPage); } }); function GoToNextPage() { WinJS.Navigation.navigate("/default.html"); } })();
But when I click the app bar icon - nothing happens :(
So what I plan to accomplish is that when someone clicks an appbar icon on default.html - the user switches to homePage.html (and then when I click the homePage button - it goes back) - but not even the initial page transfer is taking place.
This is embarrassing to ask but I can't just fold my hands and wait for something magical to happen. I have been working on this for an hour - read videos and samples but it's not working at all.
Would appreciate help - I can't figure out what's going wrong. Thanks!
原文:https://stackoverflow.com/questions/12438343
最满意答案
这是我用来以编程方式减慢ScrollView滚动速度的代码,
ObjectAnimator anim = ObjectAnimator.ofInt(mScrollView, "scrollY", mScrollView.getBottom()); anim.setDuration(9000); anim.start();
mScrollView - 您的ScrollView
mScrollView = (ScrollView) findViewById(R.id.scrollView1);
anima.setDuration(int Value) - 值越大,我在Switch Button OnCheckedChangedListener中使用代码块的滚动越慢。
Here is the code I used to slow down the scroll speed of ScrollView programmatically,
ObjectAnimator anim = ObjectAnimator.ofInt(mScrollView, "scrollY", mScrollView.getBottom()); anim.setDuration(9000); anim.start();
mScrollView - Your ScrollView
mScrollView = (ScrollView) findViewById(R.id.scrollView1);
anima.setDuration(int Value) - greater the value, slower the scroll I used the code block in Switch Button OnCheckedChangedListener.
相关问答
更多-
答案也位于: ScrollView有两个视图,第一个视图填充屏幕 我所做的是以编程方式为寻呼机安排该空间。 另一个答案的这一部分对我有用。 layout = (LinearLayout)findViewById(R.id.linlayout); f1=(FrameLayout) findViewById(R.id.f1); f2=(FrameLayout) findViewById(R.id.f2); ViewTreeObserver vto = la ...
-
ScrollView中的ListView在Android上不滚动(ListView inside ScrollView is not scrolling on Android)[2022-06-29]
您不应该将ListView放在ScrollView因为ListView类实现了自己的滚动,并且它不会接收手势,因为它们都由父ScrollView处理。 我强烈建议您以某种方式简化布局。 例如,您可以添加要滚动到ListView作为页眉或页脚的视图。 更新 : 从API Level 21(Lollipop)嵌套滚动容器开始,由Android SDK正式支持。 View和ViewGroup类中有一些方法可以提供此功能。 要使Lollipop上的嵌套滚动工作,您必须通过向其XML声明添加android:neste ... -
我的Scrollview没有使用LinearLayout android滚动(My Scrollview is not scrolling with a LinearLayout android)[2021-10-22]
看看布局,纵向可能没有足够的内容甚至需要视图滚动。 我把它插入Android Studio,只能在横向时滚动。 另外,作为一般规则, ScrollView (您的LinearLayout )的子ScrollView应该使用wrap_content而不是match_parent 。 如果您希望ScrollView始终至少填满屏幕,则可以在ScrollView上使用android:fillViewPort="true"属性。 Looking at the layout, in portrait there is ... -
scrollview中的Scrollview需要防止同时滚动(Scrollview in scrollview need to prevent simultaneous scrolling)[2021-09-04]
把这段代码放在你显示自定义视图的地方 if (otherView.hidden==false) outerScrollView.scrollEnabled =false; else outerScrollView.scrollEnabled =true; put this block of code, where you are showing the custom view if (otherView.hidden==false) outerScrollView.scrollEnabl ... -
在Android中如何以不同的滚动速度同步scrollview?(In Android how to synchronize scrollview with different scrolling speeds?)[2023-07-05]
这是我用来以编程方式减慢ScrollView滚动速度的代码, ObjectAnimator anim = ObjectAnimator.ofInt(mScrollView, "scrollY", mScrollView.getBottom()); anim.setDuration(9000); anim.start(); mScrollView - 您的ScrollView mScrollView ... -
检测ScrollView是否向上或向下滚动 - Android(Detect if a ScrollView is scrolling up or down - Android)[2022-06-09]
您需要创建一个扩展ScrollView的类 public class ExampleScrollView extends ScrollView 然后覆盖onScrollChanged ,它为您提供新的和新的滚动位置,并从那里您可以检测到哪个方向 protected void onScrollChanged(int l, int t, int oldl, int oldt) you need to create a class that extends ScrollView public class ... -
我认为问题出在calendar_day_view中的translationY属性中。 说实话,这是我第一次看到这种对齐元素的方式:) 所以发生的事情是你的所有TextView基本上都放在同一个Y位置(因为它们放在RelativeLayout里面)。 它们只是在视觉上垂直翻译。 这就是为什么从布局角度来看,对于ScrollView,文本视图的总高度不超过scrollView的高度,这就是为什么它们不滚动。 你必须稍微修改你的对齐。 首先,将LinearLayout方向更改为vertical并删除兄弟Relat ...
-
ScrollView以高滚动速度忽略setScrollX()(ScrollView is ignoring setScrollX()at high scrolling speeds)[2023-06-27]
最后我得到了解决方案。 我扩展了HorizontalcrollView: public class stepScrollView extends HorizontalScrollView { public stepScrollView(Context context) { super(context); } public stepScrollView(Context context, AttributeSet attrs) { super(context, attrs); } publi ... -
您应该小心RelativeLayout行为意外很多次。 所以你应该使用LinearLayout 。 只需替换你的代码您面临此问题,因为您正在使用具有ListView ScrollView 。 两者都具有与问题冲突的默认滚动属性。 检查此SO帖子以解决问题。 Your facing this issue because you are using ScrollView in which having ListView. Both having default scroll property which conflicting the issue. Check this SO post for resolving the i ...
相关文章
更多- Working on Free Software
- Python IndentationError:expected an indented block的解决方案
- Hadoop HDFS Wrong FS: hdfs:/ expected file:///
- 工作区和暂存区-git入门教程
- RFC2848--The PINT Service Protocol: Extensions to SIP and SDP for IP Access to Telephone Call Services
- Stocks retreat slightly
- 微信公众平台开发(69)百度地图导航
- 配置文件出错
- 最近工作回顾
- 微信数据导出。
最新问答
更多- 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
- 如何通过引用返回对象?(How is returning an object by reference possible?)
- 矩阵如何存储在内存中?(How are matrices stored in memory?)
- 每个请求的Java新会话?(Java New Session For Each Request?)
- css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
- 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
- xcode语法颜色编码解释?(xcode syntax color coding explained?)
- 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
- 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
- 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
- 西安哪有PLC可控制编程的培训
- 在Entity Framework中选择基类(Select base class in Entity Framework)
- 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
- 电脑二级VF有什么用
- Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
- 金华英语角.
- 手机软件如何制作
- 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
- 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
- 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
- Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
- 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
- python的访问器方法有哪些
- DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
- 在Ruby中对组合进行排序(Sorting a combination in Ruby)
- 网站开发的流程?
- 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
- 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
- 透明度错误IE11(Transparency bug IE11)
- linux的基本操作命令。。。