【问题标题】:Adding Grid view in Group header and Grid view in Child view in Expandable listview in android在 android 的可扩展列表视图中的子视图中添加组标题中的网格视图和网格视图
【发布时间】:2017-06-12 11:26:10
【问题描述】:

在我的程序中,我试图在 android 的 Expandable listview 中添加组标题和子视图作为网格视图。

【问题讨论】:

  • 所有发布的都是程序描述。但是,我们需要您ask a question。我们无法确定您想从我们这里得到什么。请edit您的帖子包含一个我们可以回答的有效问题。提醒:请确保您知道what is on-topic here,请我们为您编写程序,建议是题外话。

标签: android listview expandablelistadapter


【解决方案1】:

我参考关注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;
 }
});

【讨论】:

    猜你喜欢
    • 2012-05-28
    • 2020-09-28
    • 1970-01-01
    • 2011-07-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多