使用按钮的Andr​​oid主屏幕滚动到下一屏幕以及滑动位 [英] Android Homescreen using a button to scroll to the next screen as well as the slide bit

查看:154
本文介绍了使用按钮的Andr​​oid主屏幕滚动到下一屏幕以及滑动位的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在做一个应用程序,有一个像主屏幕的风格滚动屏幕。我已经实现这个解决方案:

I am making an app that has a scrolling screen like the homescreen style. I have implemented this solution:

的Andr​​oid主屏幕

它的伟大工程,但我也希望那里是每个页面上的按钮,你可以点击进入下一个页面,但我只是不知道如何做到这一点!有人可以帮忙吗?我一直盯着这个code现在天!

It works great but I also want there to be buttons on each page that you can click to go to the next page but I just can't figure out how to do it! can someone help? I've been staring at this code for days now!

感谢

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

更新 - 帮助

我真不明白怎么去从周围的其他活动调用SetToScreen的问题,任何人都可以有所帮助,如果我尝试我不断收到静态调用错误。

I really don't understand how to get around the problem of calling the SetToScreen from the other activity, Can anyone help as if I try I do keep getting Static call errors.

推荐答案

public void setToScreen(int whichScreen) {}

使用此功能设置上点击屏幕上。

Use this function to set to a screen on a click.

您应该扩展Draggablespace通过添加一个函数来得到像当前空间:

you should extend Draggablespace by adding a function to get the current space like:

public int getCurrentScreen() {
    return this.mCurrentScreen;
}

那么你可以编写自己的函数在你喜欢的活动。

then you can write your own functions in your activity like

public void nextScreen() {
    draggableSpace.setToScreen(draggableSpace.getCurrentScreen() + 1));
}

同为previous屏幕。

The same for previous screen.

现在你只需要检查是否有另外一个窗口,等待,如果你要前进或后退。

Now you only need to check if there is an additional screen waiting if you are going forward or backward.

(当然draggableSpace是你的类draggablespace ...不是一个静态调用的对象!)

(Of course draggableSpace is your object of the class draggablespace...not a static call!)

这篇关于使用按钮的Andr​​oid主屏幕滚动到下一屏幕以及滑动位的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆