In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article will explain in detail about ScrollView and ListView nested use caused ListView display incomplete how to do, Xiaobian think quite practical, so share to everyone as a reference, I hope you can read this article after harvest.
solutions
Actively calculate and set the height of ListView, so that you can reasonably display the height of ListView. The code is as follows:
public void setListViewHeightBasedOnChildren(ListView listView) { //Get ListAdapter listAdapter = listView.getAdapter(); if (listAdapter == null) { return; } int totalHeight = 0; // listAdapter.getCount() Returns the number of data items for (int i = 0; i < listAdapter.getCount(); i++) { View listItem = listAdapter.getView(i, null, listView); //calculate the width and height of the child View listItem.measure(0, 0); //count the total height of all children totalHeight += listItem.getMeasuredHeight(); } ViewGroup.LayoutParams params = listView.getLayoutParams(); params.height = totalHeight +(listView.getDividerHeight() *(listAdapter.getCount()-1)); // listView.getDividerHeight() Get the height occupied by separators between subitems// params.height Finally get the height required for the complete display of the entire ListView listView.setLayoutParams(params);} About "ScrollView and ListView nested use lead to ListView display incomplete how to do" This article is shared here, I hope the above content can be of some help to everyone, so that you can learn more knowledge, if you think the article is good, please share it to let more people see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.