相关疑难解决方法(0)

在父母之外动画儿童视图

我试图在其父视图之外设置一个视图的动画,当我这样做时,子视图无法在其父视图之外进行动画处理.我通过使用setClipChildren(false)它解决了这个问题并且它工作了...当视图动画化.当我为视图设置动画,图像仍然是隐藏的.

这是有效的代码.此代码会将平铺按钮设置为屏幕顶部的动画:

private void setGameBoard(){

        brickWall.setClipChildren(false);
        brickWall.setClipToPadding(false);

        //Build game board
        for(int ii = 0; ii < brickRows;ii++){
            final int x = ii;

            //Build table rows
            row = new TableRow(this.getApplicationContext());
            row.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, 50));
            row.setClipChildren(false);
            row.setClipToPadding(false);

           // row.setBackgroundColor(ResourcesCompat.getColor(getResources(), R.color.colorAccent, null));

            //Build table tiles
            for(int jj=0; jj < brickColumns; jj++){
                final int y = jj;
                final Brick tile = new Brick(this);
                tile.setClipBounds(null);

                tile.setBackgroundColor(ResourcesCompat.getColor(getResources(), R.color.colorPrimary, null));

                //Set margins to create look of tic-tac-toe
                TableRow.LayoutParams lp = new TableRow.LayoutParams( …
Run Code Online (Sandbox Code Playgroud)

animation android android-animation

4
推荐指数
2
解决办法
1962
查看次数

标签 统计

android ×1

android-animation ×1

animation ×1