在组 header 中添加网格视图,在 android 中的可扩展列表视图中添加网格视图 Child

Adding Grid view in Group header and Grid view in Child view in Expandable listview in android

在我的程序中,我试图将组 header 和 Child 视图添加为 android 中的可扩展 listview 中的网格视图。

我参考下面post

解决了
 int finalHeight, finalWidth;
final ImageView iv = (ImageView)findViewById(R.id.scaled_image);
final TextView tv = (TextView)findViewById(R.id.size_label);
ViewTreeObserver vto = iv.getViewTreeObserver();
vto.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
public boolean onPreDraw() {
    iv.getViewTreeObserver().removeOnPreDrawListener(this);
    finalHeight = iv.getMeasuredHeight();
    finalWidth = iv.getMeasuredWidth();
    tv.setText("Height: " + finalHeight + " Width: " + finalWidth);
    return true;
 }
});