I have a ListView inside which I dynamicaly fill the list items in the getView() method, with a combination of TextView, and an ImageView.
I need to calculate the size of the Text and Image view inside the getView, so I will be able to set visibility=gone, if View is too big. I am tring:
public View getView(int position, View convertView, ViewGroup parent) {
..
View listItem=view.findViewById(R.id.listItem);
ImageView imageView=(ImageView)view.findViewById(R.id.myImg);
TextView textView=(TextView)view.findViewById(R.id.mytxt);
if (imageView.getRight()>listItemText.getRight()) {
imageView.setVisibility(View.GONE);
}
if (textView.getRight()>listItemText.getRight()) {
textView.setVisibility(View.GONE);
}
..
}
However since I'm inside the getView(), the values of layout are not yet created, so I get false values for the View.getRight() call.
Any ideas how to do this?