本文整理汇总了Java中android.widget.AbsListView.CHOICE_MODE_MULTIPLE属性的典型用法代码示例。如果您正苦于以下问题:Java AbsListView.CHOICE_MODE_MULTIPLE属性的具体用法?Java AbsListView.CHOICE_MODE_MULTIPLE怎么用?Java AbsListView.CHOICE_MODE_MULTIPLE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类android.widget.AbsListView
的用法示例。
在下文中一共展示了AbsListView.CHOICE_MODE_MULTIPLE属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getView
/**
* Populate new items in the list.
*/
@NonNull
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row = convertView;
EpisodeHolder holder = null;
if (convertView == null) {
row = mInflater.inflate(R.layout.episode_item, null);
holder = new EpisodeHolder(row);
row.setTag(holder);
} else {
holder = (EpisodeHolder) row.getTag();
}
if (position < mResults.size()) {
final Episode lEpisode = mResults.get(position);
holder.populateFrom(lEpisode);
holder.mMenu.setVisibility(View.INVISIBLE);
holder.mMenu.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//CastUtils.showQueuePopup(getContext(), view, MediaInfoUtils.buildMediaInfo(mAnime, lEpisode));
}
});
if (!TextUtils.isEmpty(mLastEpisodeViewed)) {
if (!mIsLibraryEpisodes) {
if (mResults.get(position).getUrl().equals(mLastEpisodeViewed)) {
holder.mTitleView.setTextColor(mLastViewedColor);
}
} else {
if (mResults.get(position).getLocalPath().equals(mLastEpisodeViewed))
holder.mTitleView.setTextColor(mLastViewedColor);
}
}
AbsListView lv = (AbsListView) parent;
if (lv.getChoiceMode() == AbsListView.CHOICE_MODE_MULTIPLE) {
position += 2;
SparseBooleanArray checkArray;
checkArray = lv.getCheckedItemPositions();
holder.mCheckView.setVisibility(View.VISIBLE);
holder.mCheckView.setChecked(false);
if (checkArray != null) {
if (checkArray.get(position)) {
holder.mCheckView.setChecked(true);
}
}
}
}
return row;
}