【问题标题】:Android: use animation outside the view areaAndroid:在视图区域外使用动画
【发布时间】:2012-04-15 23:09:39
【问题描述】:

我有一个包含 12 个图像的 xml。例如 3*4 表格,其中每个单元格包含一个图像。 在 OnCreate 中,我为每个图像编写动画:

AnimationSet set = new AnimationSet(true);
        Animation animation = new TranslateAnimation(
                Animation.ABSOLUTE, -300.0f, Animation.START_ON_FIRST_FRAME, 0.0f,
            Animation.ABSOLUTE, -800.0f, Animation.START_ON_FIRST_FRAME, 0.0f);

        animation.setFillBefore(true);
        animation.setFillAfter(true);
        animation.setFillEnabled(true);
        animation.setDuration(5000);

我想从屏幕左上角开始动画并将动画结束到真实位置。但动画仅使用图像或单元格区域。动画有没有解决办法,用全屏?

【问题讨论】:

    标签: android animation area


    【解决方案1】:

    如果它们都在同一个父视图下,您可以将父视图的 clipChildren 属性设置为 false,这将允许动画超出其自身的约束(只要它仍然保持在其父视图的边界内):

    android:clipChildren="false"
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-05
      • 2012-07-27
      • 2017-01-31
      • 1970-01-01
      相关资源
      最近更新 更多