int totalHeight = 0;
for (int i = 0; i < mStrings.length; i++) {
    //pullList ListView
    //mAdapter Adapter
    View listItem = mAdapter.getView(i, null, pullList);
    listItem.measure(0, 0);
    totalHeight += listItem.getMeasuredHeight();
}
ViewGroup.LayoutParams params = pullList.getLayoutParams();
params.height = totalHeight
        + (pullList.getDividerHeight() * (mAdapter.getCount() - 1));
pullList.setLayoutParams(params);


参考:

1. http://wfkbyni.iteye.com/blog/1545120

相关文章:

  • 2022-12-23
  • 2021-12-21
  • 2021-11-30
  • 2021-06-02
  • 2021-08-28
  • 2021-06-28
  • 2021-12-30
  • 2021-10-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-17
  • 2021-12-08
相关资源
相似解决方案