0
동적으로 채우려는 ListView 만 포함하는 ListFragment가 있습니다. 문제는 RatingBar 뷰로 채우고 싶습니다. 내가하는 일은 RatingBar를 선언 한 다음 View에 추가하는 것입니다.ListFragment에 동적으로 RatingBar 추가
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
RatingBar rb = new RatingBar(this.getActivity());
rb.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,LayoutParams.WRAP_CONTENT));
getListView().addView(rb);
return (LinearLayout)inflater.inflate(R.layout.tab_frag1_layout, container, false);
}
나는 오류 얻을 :
java.lang.IllegalStateException: Content view not yet created
가 어떻게이 ListFragment 안에 각각의 ListView 라인에 RatingBar를 추가 할 수 있습니까?
편집 : 좋아 그래서 난 내 코드 변경이로 :