简体   繁体   English

在Android / MonoAndroid中滑动查看?

[英]Swipe View in Android/MonoAndroid?

I am wondering is there a view in android that you can swipe and it goes to another view? 我想知道android中是否有可以滑动的视图,它会转到另一个视图? I am using mono Android but can't seem to find anything on how to do this. 我使用的是Mono Android,但似乎找不到有关此操作的任何信息。 I expanded my search to android but can't find anything as well. 我将搜索范围扩展到了android,但找不到任何东西。

Does anyone know a sample project that has this that I can look at and use? 有人知道有一个我可以查看和使用的示例项目吗?

There is currently no View that comes with Android that does this. Android目前没有执行此操作的View。 There are however several 3rd party ones. 但是,有一些第三方的。

@Commonsguy extended ViewFlipper to make it recognize swipe touch events and flip views accordingly. @Commonsguy扩展了ViewFlipper,使其可以识别滑动触摸事件并相应地翻转视图。

Check out the ViewSwiper source code 查看ViewSwiper源代码

Edit: I am not familiar with monodroid, so I am afraid I am of no help there. 编辑:我对Monodroid不熟悉,所以我在那里对我没有帮助。 And the difference between them is that ViewSwiper has extended ViewFlipper and adds support for switching views via a swipe or "fling" gesture on the screen. 它们之间的区别在于ViewSwiper扩展了ViewFlipper并增加了通过在屏幕上滑动或“滑动”手势来切换视图的支持。 View flipper has no such support by default. 默认情况下,View Flipper不提供此类支持。

Google released the compatibility pack with some new UI Elements, which you can download via SDK Manager. Google发布了兼容包,其中包含一些新的UI元素,您可以通过SDK Manager下载。

  • put the .jar file located in sdkfolder/extras/compatibility in your build path. 将位于sdkfolder/extras/compatibility中的.jar文件放入您的构建路径中。

  • now you can use a class called ViewPager which behaves like the Android Homescreen. 现在,您可以使用行为类似于Android Homescreen的ViewPager类。

Or, if you are using Eclipse and ADT plugin v12 or higher, just right click your project, choose "Android Tools" and then "add compatibility package". 或者,如果您使用的是Eclipse和ADT插件v12或更高版本,则只需右键单击您的项目,选择“ Android工具”,然后选择“添加兼容性包”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM