Imageview and textview not displaying in view?

前端 未结 1 1526
囚心锁ツ
囚心锁ツ 2021-01-21 15:51

I\'m trying to inflate a layout and add it to the draggable grid view But all I get is a yellow sqaure. The draggable view\'s addView() method is only picking up a single view.

相关标签:
1条回答
  • 2021-01-21 15:59

    This is a known problem with the DraggableGridView that -- unfortunately -- I haven't gotten around to fixing. When I wrote DGV, I didn't entirely grasp how views were laid out. You might try having DGV measure each child before laying it out. Adding something like:

    getChildAt(i).measure(MeasureSpec.makeMeasureSpec(childSize, MeasureSpec.EXACTLY), MeasureSpec.makeMeasureSpec(childSize, MeasureSpec.EXACTLY));
    

    before the layout on this line:

    getChildAt(i).layout(xy.x, xy.y, xy.x + childSize, xy.y + childSize);
    
    0 讨论(0)
提交回复
热议问题