如何把一个以正面没有调用bringToFront()?bringToFront

由网友(停尸间里朗诵情诗)分享简介:显然有一个bug在Android的打破 View.bringToFront 。There is apparently a bug in Android which breaks View.bringToFront.如果我有安排在一个GridView意见,并希望通过调用bringToFront()把视角的面前,它可能...

显然有一个bug在Android的打破 View.bringToFront

There is apparently a bug in Android which breaks View.bringToFront.

如果我有安排在一个GridView意见,并希望通过调用bringToFront()把视角的面前,它可能会移动到GridView的右下角位置。

If I have Views arranged in a GridView and want to bring a View to front by calling bringToFront(), it may get moved to the bottom right position in the GridView.

有什么见不得人的事情出现,所以我不能用bringToFront()。如果我不叫了,一切工作正常。但观重叠 - 如果我使用规模的动画来扩展视图,它部分由视图的底部和右侧遮蔽

Something shady is going on there, so I can't use bringToFront(). When I don't call it, everything works fine. But the Views overlap - if I use scale animation to scale up a View, it's partially obscured by the Views to the bottom and to the right.

我已经签出bringToFront的来源,它调用parent.bringChildToFront(...)

I've checked out bringToFront's source and it calls parent.bringChildToFront(...)

这是这个方法

public void bringChildToFront(View child) {
     int index = indexOfChild(child);
      if (index >= 0) {
          removeFromArray(index);
          addInArray(child, mChildrenCount);
          child.mParent = this;
      }
  }

它显然删除查看从本身!毫不手软!是一个ViewGroup中这样愚蠢的,它不能管理Z-指数以任何其他方式洗牌周围的控制?显然,当GridView控件删除其子,然后再次将其添加回,它被放置在电网的末端!

it apparently removes the View from itself! Without mercy! Is a ViewGroup so dumb that it can't manage Z-indexes in any other way that shuffling controls around? Obviously when GridView removes its child and then adds it back again, it gets placed at the end of the Grid!

有什么我可以做,以显示在别人的顶部视图而不是诉诸一些黑客?浮现在我的脑海里有一件事是创建GridView控件,这将显示为上面的那个我想bringToFront()上面的另一种观点,但我不喜欢这样的解决方案。

Is there anything I can do to show a View on top of others without resorting to some hacking? One thing that comes to my mind is to create another View above the GridView, which will appear to be above the one I'm trying to bringToFront(), but I don't like this solution.

推荐答案

显然我错过了安卓clipChildren =假属性GridView控件。它解决了我的问题。

apparently I missed the android:clipChildren="false" property in GridView. It solves my problem.

阅读全文

相关推荐

最新文章