-2
我知道,像方法:有多種佈局使用列表視圖
@Override
public int getItemViewType(int position) {
// Define a way to determine which layout to use, here it's just evens and odds.
return position % 2;
}
@Override
public int getViewTypeCount() {
return 2; // Count of different layouts
}
是有益的,當我們要使用多個佈局與單個適配器。 但是,這些方法根據列表視圖中行的「位置」確定要使用的佈局。但是,就我而言,要使用的佈局取決於要在行中顯示的數據類型。所以,對於行位置,我不能知道要使用哪種佈局。 請幫忙!