本文整理汇总了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);
}
}