本文整理匯總了Java中android.widget.BaseAdapter.getView方法的典型用法代碼示例。如果您正苦於以下問題:Java BaseAdapter.getView方法的具體用法?Java BaseAdapter.getView怎麽用?Java BaseAdapter.getView使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.widget.BaseAdapter
的用法示例。
在下文中一共展示了BaseAdapter.getView方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setAdapter
import android.widget.BaseAdapter; //導入方法依賴的package包/類
public void setAdapter(BaseAdapter adapter, ArrayList<Rect> childLocationInfo) {
this.childLocationInfo = childLocationInfo;
setChildRectPadding();
removeAllViews();
int count = adapter.getCount();
for (int i = 0; i < count; i++) {
AnimContainer view = (AnimContainer) adapter.getView(i, null, this);
if (view != null) {
final int index = i;
// 將position設置到id,方便以後查詢用,如果有用到setId的請注意
view.setId(i);
// 看各位喜歡事件是否放到view還是adapter
view.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (onItemClickedListener != null) {
onItemClickedListener.onItemClicked(v, index);
}
}
});
// 防止最左邊tab按左鍵移動時,焦點跑出layout
if (isFirstColumn(childLocationInfo.get(i))) {
view.setNextFocusLeftId(view.getId());
}
this.addView(view);
}
}
}
示例2: populateWallpapersFromAdapter
import android.widget.BaseAdapter; //導入方法依賴的package包/類
@Thunk void populateWallpapersFromAdapter(ViewGroup parent, BaseAdapter adapter,
boolean addLongPressHandler) {
for (int i = 0; i < adapter.getCount(); i++) {
FrameLayout thumbnail = (FrameLayout) adapter.getView(i, null, parent);
parent.addView(thumbnail, i);
WallpaperTileInfo info = (WallpaperTileInfo) adapter.getItem(i);
thumbnail.setTag(info);
info.setView(thumbnail);
if (addLongPressHandler) {
addLongPressHandler(thumbnail);
}
thumbnail.setOnClickListener(mThumbnailOnClickListener);
}
}