如何绘制在Android的定制库 [英] how to draw custom gallery in android

查看:140
本文介绍了如何绘制在Android的定制库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想根据其中缩略图可以上下移动,从左到右同时在图像上开发的应用程序。

I want to develop an app based on the image in which thumbnails can move from top to bottom and left to right simultaneously.

请参考图像,其中灰色部分为缩略图。
我想从那里我可以开始知道

please refer the image where gray parts are the thumbnails. I want to know from where i can start

寻找帮助

推荐答案

我觉得你不需要处理双方的意见滚动,而只是从一个视图移动项目到另一个。以下代码段从横向滚动视图垂直滚动动作来看孩子。

I think that you do not need to handle the scroll of both the views, but just move the items from one view to another. The below snippet moves children from the horizontal scroll view to the vertical scroll view.

int[] xy = new int[2];

// horizontalComponents contains all the children of the 
// horizontal scroll view, this statement reads the location
// of the ith child of the view.
horizontalComponents[i].getLocationInWindow(xy);

// Check for some limit of the x-coordinate
if (xy[0] < 58) {
    // Linear layout in horizontal scroll view & 
    // vertical scroll view respectively
    hrzChild.removeView(horizontalComponents[i]);
    vertChild.addView(horizontalComponents[i]);
    hrzScroll.fullScroll(HorizontalScrollView.FOCUS_LEFT);
    vertScroll.scrollTo(0, 0);
}

我已经把这个片段水平滚动视图的姿态侦听器的onScroll方法。

I've put this snippet in the onScroll method of a gesture listener of the horizontal scroll view.

我希望它能帮助。

这篇关于如何绘制在Android的定制库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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