机器人 - 地图列表视图中的头 [英] android - map in listview header

查看:111
本文介绍了机器人 - 地图列表视图中的头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序我有一个包含一个图像,并在底部的列表视图的活动。以下是东西在活动中完成。

In my app i have an activity which contains a image and a list view at the bottom. Following are the things to be done in the activity.

1. the image view at the top of the page must be of swipe type to show other images.
2. when the list view gets scrolled the image must get moved along with it.
3. in the same activity i have a button, when the button is clicked the image must be switcher over to be a mapview.

我所做的是,

1. I have the image view and mapview in view switcher of a separate layout named as header
2. The header layout is been added in the list view header part.

现在的,而列表视图滚动时,头部分被与它一起滚动,在视图时被切换,我能够图像视图和地图视图之间切换一样。
但地图似乎是固定的,不能被移动以查看各点

Now the while the list view is scrolled, the header part gets scrolled along with it, in the same when the view gets switched i am able to switch between image view and map view. But the map is seems to be a fixed one and cannot be moved to see various points

如何列表视图标题的地图视图内移动。

how to move inside the map view of list view header.

推荐答案

这是一个例子,但不是解决办法。在这个例子中我已经取得在X方向滚动时,它返回假定制滚动视图(表示该事件没有被处理,并且应该被传递到下一个视图):

This is an example but not the solution. In this example I've made a custom scrollview which returns false when scrolled in the x-direction (indicating that the event haven't been handled and should be passed on to the next view):

public class CustomScrollView extends ScrollView {
    private GestureDetector mGestureDetector;
    View.OnTouchListener mGestureListener;

    public CustomScrollView(Context context, AttributeSet attrs) {
        super(context, attrs);
        mGestureDetector = new GestureDetector(new YScrollDetector());
        setFadingEdgeLength(0);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {
        return super.onInterceptTouchEvent(ev) && mGestureDetector.onTouchEvent(ev);
    }

    // Return false if we're scrolling in the x direction  
    class YScrollDetector extends SimpleOnGestureListener {
        @Override
        public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) {
            if(Math.abs(distanceY) > Math.abs(distanceX)) {
                return true;
            }
            return false;
        }
    }
}

您需要做在你viewswitcher的某个区域类似的事情。所以,你需要修改基本viewswitchercomponent,使自己的变体。

You need to do something similar in a certain region of your viewswitcher. So you need to modify the basic viewswitchercomponent and make your own variant.

作为替代上述建议,我会考虑不这样做。如果你看看周围在使用地图应用程序这实在不是一个正常的行为,我怀疑它会运行得很流畅,或使一个很好的用户交互。地图一般,当他们得到尽可能多的空间可能效果最好。看看一些基本的地图应用:谷歌导航,谷歌地图,谷歌纵横,Yelp的

As an alternative to the above suggestion I'd consider not doing it. If you look at apps around using maps this is really not a normal behavior and I doubt it'll run very smooth or make a good user interaction. Maps in general works best when they get as much space as possible. Take a look at some basic map apps: Google Navigation, Google Maps, Google latitude, Yelp.

这篇关于机器人 - 地图列表视图中的头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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