拖动查看RelativeLayout的外 [英] Dragging a view outside of RelativeLayout

查看:170
本文介绍了拖动查看RelativeLayout的外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经实现,可以装在一个RelativeLayout的时左右拖动一个自定义的ImageView。 Essnetially,我改变LEFTMARGIN和TOPMARGIN布局参数作为视图被拖动。

I have implemented a custom ImageView that can be dragged around when housed in a RelativeLayout. Essnetially, I change the leftMargin and topMargin of the layout parameters as the view is being dragged.

这主要是按预期工作。我可以拖动视图。对于保证金做工精细,甚至负值。视图可以被拖动的左边缘以及顶边缘外

This mostly works as expected. I can drag the view around. Even negative values for the margin work fine. The view can be dragged outside the left edge as well as the top edge.

问题是我不能够拖动右边缘或底部边缘外的景色。事实上,视图开始萎缩,因为我尝试将它以外的任何两个边。

The problem is I am not able to drag the view outside of right edge or the bottom edge. In fact, the view starts to shrink as I try to drag it outside any of these two edges.

我打了clipChidren,以及在RelativeLayout的clipToPadding参数,但是这是有帮助没有。

I played with "clipChidren" as well as "clipToPadding" parameters on the RelativeLayout but that wasn't of any help.

我想AP preciate,如果有人能指导我如何在右边缘或底部边缘显示的局部视图上。预先感谢您的帮助。

I would appreciate it if someone can guide me on how to display a partial view at the right edge or the bottom edge. Thank you in advance for your help.

推荐答案

此问题可如果更改需要解决的 rightMargin bottomMargin 以及拖动时。当您更改所有四个边距,您将获得所需的行为。

This problem can be resolved if you change the rightMargin and bottomMargin as well when dragging. When you change all four margins, you will get the desired behaviour.

这篇关于拖动查看RelativeLayout的外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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