헤더 행의 expandableListView에 notesCounter (TextView)가 있습니다. 나는 동등한 동그라미를 그려보고 싶다. TextView 높이는 match_parent로 설정됩니다. 이제 내 문제를 시작하십시오 ... 높이와 같은 타원형의 너비를 설정하고 싶습니다. 나는 그것을 측정, 올바른 값 (높이) 반환, TextView, 그것을 설정하지만 새로 고치지 않습니다. 내 질문 : 어떻게 TextView 새로 고침?TextView의 너비를 높이와 동일하게 설정하고 다시 그리는 방법은 무엇입니까?
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View rowView, ViewGroup parent) {
Container container = (Container) getGroup(groupPosition);
if (rowView == null) {
rowView = inflater.inflate(R.layout.item_container, null);
}
TextView containerName = (TextView) rowView.findViewById(R.id.container_name);
containerName.setText(container.name);
notesCounter = (TextView) rowView.findViewById(R.id.notes_counter);
notesCounter.setText(getChildrenCount(groupPosition) + "");
final TextView nt = notesCounter;
notesCounter.post(new Runnable() {
@Override
public void run() {
// nt.getHeight() - return 67 - good!
notesCounter.setWidth(nt.getHeight()); // I WANT REDRAW IT AND SEE EQUAL CIRCLE!
//notesCounter will set width after swipe ExpandableListView and "hide and then appear view"
}
});
Util.loadFont(context, containerName, FONT.GothamExtraLight);
Util.loadFont(context, notesCounter, FONT.GothamExtraLight);
return rowView;
}
안녕이 당신이 나를 위해 일을하지 않는 텍스트 뷰 –
에 무효화()를 호출 할 수 있습니다. – DennyDog
'notesCounter.requestLayout()'은 어떻습니까? – myanimal