BaseAdapter를 확장하는 자체 어댑터를 만들고 GridView에 사용합니다. 요소의 수를 얻어 TextView에 넣기를 원합니다. 내 어댑터를했다 : GridView의 Adapter에있는 요소의 번호가 잘못되었습니다.
위치는 reseted 같다 :
@Override
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = (LayoutInflater) context
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
View gridView;
if(convertView == null){
gridView = new View(context);
gridView = inflater.inflate(R.layout.grid_element, null);
ImageView logo = (ImageView) gridView.findViewById(R.id.grid_logo);
TextView tv = (TextView) gridView.findViewById(R.id.grid_textView1);
tv.setText(level+position);
}
else
gridView = convertView;
return gridView;
}
내가 발사에 화면에없는 요소를 얻을 때까지 좋은 것 같다. 어떻게해야 제대로 할 수 있습니까?
재활용 될 때 뷰가 생성되는 경우 (
convertView == null
를)findViewById()
를 사용하고getTag()
방법에서 다시 얻기보다! 고맙습니다:) –