本文整理汇总了Java中android.view.View.setTag方法的典型用法代码示例。如果您正苦于以下问题:Java View.setTag方法的具体用法?Java View.setTag怎么用?Java View.setTag使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.setTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holer;
if (convertView == null) {
convertView = View.inflate(mContext, R.layout.item_channel, null);
holer = new ViewHolder(convertView);
convertView.setTag(holer);
} else {
holer = (ViewHolder) convertView.getTag();
}
ResultBean.ChannelInfoBean channelInfoBean = channel_info.get(position);
holer.tvChannel.setText(channelInfoBean.getChannel_name());
Glide.with(mContext)
.load(Constants.BASE_URl_IMAGE +channelInfoBean.getImage())
.into(holer.ivChannel);
return convertView;
}
示例2: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
if (position == 0) {
TextView title = convertView != null
? (TextView) convertView
: (TextView) LayoutInflater.from(parent.getContext())
.inflate(R.layout.redbox_item_title, parent, false);
title.setText(mTitle);
return title;
} else {
if (convertView == null) {
convertView = LayoutInflater.from(parent.getContext())
.inflate(R.layout.redbox_item_frame, parent, false);
convertView.setTag(new FrameViewHolder(convertView));
}
StackFrame frame = mStack[position - 1];
FrameViewHolder holder = (FrameViewHolder) convertView.getTag();
holder.mMethodView.setText(frame.getMethod());
holder.mFileView.setText(StackTraceHelper.formatFrameSource(frame));
return convertView;
}
}
示例3: getView
import android.view.View; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
View view = convertView;
ViewHolder holder;
if (convertView == null) {
view = inflater.inflate(R.layout.item_fact, null);
holder = new ViewHolder();
holder.tv_id = (TextView) view.findViewById(R.id.textView_item_id);
;
holder.tv_fact = (TextView) view
.findViewById(R.id.textView_item_fact);
view.setTag(holder);
} else
holder = (ViewHolder) view.getTag();
String str_id = mSubData.get(position).getId() + "";
if (mSubData.get(position).getId() == -1)
str_id = "Unknown Id";
holder.tv_id.setText(str_id);
holder.tv_fact.setText(mSubData.get(position).getFact());
return view;
}
示例4: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder holder = null;
if (convertView == null) {
holder = new ViewHolder();
convertView = LayoutInflater.from(MainActivity.this).inflate(R.layout.item_search_history_word, null);
holder.tv_word = (TextView) convertView.findViewById(R.id.tv_search_record);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.tv_word.setText(historywordsList.get(position).toString());
return convertView;
}
示例5: getView
import android.view.View; //导入方法依赖的package包/类
public View getView(final int position, View convertView,
final ViewGroup parent) {
final Holder holder;
if (convertView == null) {
holder = new Holder();
convertView = context.getLayoutInflater().inflate(
R.layout.item_cinemalist, null);
holder.tvCinemaName = (TextView) convertView
.findViewById(R.id.tvCinemaName);
holder.tvCinemaId = (TextView) convertView
.findViewById(R.id.tvCinemaId);
convertView.setTag(holder);
} else {
holder = (Holder) convertView.getTag();
}
CinemaBean cinema = cinemaList.get(position);
holder.tvCinemaName.setText(cinema.getCinemaName());
holder.tvCinemaId.setText(cinema.getCinemaId());
return convertView;
}
示例6: getView
import android.view.View; //导入方法依赖的package包/类
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
ViewHolder viewHolder;
if(convertView == null){
LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
convertView = inflater.inflate(R.layout.setting_list_row, null);
viewHolder = new ViewHolder();
viewHolder.title = (TextView) convertView.findViewById(R.id.tvSettingList);
convertView.setTag(viewHolder);
}else{
viewHolder = (ViewHolder) convertView.getTag();
}
Setting setting = getItem(position);
viewHolder.title.setText(setting.getName());
return convertView;
}
示例7: onBindViewHolder
import android.view.View; //导入方法依赖的package包/类
/**
* To bind different types of holder and solve different the bind events
*
* @param holder
* @param positions
* @see #getDefItemViewType(int)
*/
@Override
public void onBindViewHolder(K holder, int positions) {
super.onBindViewHolder(holder, positions);
int viewType = holder.getItemViewType();
if (mItemTouchHelper != null && itemDragEnabled && viewType != LOADING_VIEW && viewType != HEADER_VIEW
&& viewType != EMPTY_VIEW && viewType != FOOTER_VIEW) {
if (mToggleViewId != NO_TOGGLE_VIEW) {
View toggleView = ((BaseViewHolder) holder).getView(mToggleViewId);
if (toggleView != null) {
toggleView.setTag(R.id.BaseQuickAdapter_viewholder_support, holder);
if (mDragOnLongPress) {
toggleView.setOnLongClickListener(mOnToggleViewLongClickListener);
} else {
toggleView.setOnTouchListener(mOnToggleViewTouchListener);
}
}
} else {
holder.itemView.setTag(R.id.BaseQuickAdapter_viewholder_support, holder);
holder.itemView.setOnLongClickListener(mOnToggleViewLongClickListener);
}
}
}
示例8: getView
import android.view.View; //导入方法依赖的package包/类
@Override public View getView(final int position, View view, ViewGroup container) {
if (view == null) {
holder = (Holder) holderCreator.createHolder();
view = holder.createView(container.getContext());
view.setTag(holder);
} else {
holder = (Holder<T>) view.getTag();
}
if(mDatas!=null&&!mDatas.isEmpty()){
holder.UpdateUI(container.getContext(), position, mDatas.get(position));
}
return view;
}
示例9: enfoceDragParity
import android.view.View; //导入方法依赖的package包/类
private void enfoceDragParity(View v, String event, int update, int expectedValue) {
Object tag = v.getTag(R.id.drag_event_parity);
int value = tag == null ? 0 : (Integer) tag;
value += update;
v.setTag(R.id.drag_event_parity, value);
if (value != expectedValue) {
Log.e(TAG, event + ": Drag contract violated: " + value);
}
}
示例10: notifyDataSetChanged
import android.view.View; //导入方法依赖的package包/类
/** 更新数据 */
public void notifyDataSetChanged() {
mTabsContainer.removeAllViews();
this.mTabCount = mTitles.length;
View tabView;
for (int i = 0; i < mTabCount; i++) {
tabView = View.inflate(mContext, R.layout.layout_tab_segment, null);
tabView.setTag(i);
addTab(i, tabView);
}
updateTabStyles();
}
示例11: getView
import android.view.View; //导入方法依赖的package包/类
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
View vi = convertView;
if(convertView == null) {
vi = inflater.inflate(R.layout.listview_content_search, null);
viewHolder = new ViewHolder();
viewHolder.tvTitle = (TextView) vi.findViewById(R.id.tv_title);
viewHolder.btnDel = (Button) vi.findViewById(R.id.btn_del);
vi.setTag(viewHolder);
}
else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.tvTitle.setText(mSearchedDevices.get(position).getName().toString());
viewHolder.btnDel.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
BluetoothDevice searchedDevice = mSearchedDevices.get(position);
String macAddress = searchedDevice.getAddress();
if (!(macAddress.equals("N/A") || TextUtils.isEmpty(macAddress))) {
if (mHandler != null) {
mHandler.OnSearchBLEClicked(searchedDevice);
}
}
dismiss();
}
});
return vi;
}
示例12: handleFooter
import android.view.View; //导入方法依赖的package包/类
/**
* Handles the footer view.
*/
private void handleFooter() {
if (mFooterViewId == DEFAULT_LAYOUT_ATTRIBUTE_VALUE || mMenuViewHolder.mMenuFooter == null) {
return;
}
View view = mLayoutInflater.inflate(mFooterViewId, null, false);
if (view != null) {
if (mMenuViewHolder.mMenuFooter.getChildCount() > 0) {
mMenuViewHolder.mMenuFooter.removeAllViews();
}
mMenuViewHolder.mMenuFooter.addView(view);
view.setTag(TAG_FOOTER);
view.bringToFront();
if (view instanceof ViewGroup) {
ViewGroup viewGroup = (ViewGroup) view;
for (int i = 0; i < viewGroup.getChildCount(); i++) {
if (viewGroup.getChildAt(i) instanceof Button) {
viewGroup.getChildAt(i).setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mOnMenuClickListener != null) {
mOnMenuClickListener.onFooterClicked();
}
}
});
return;
}
}
}
}
}
示例13: createImageLayout
import android.view.View; //导入方法依赖的package包/类
/**
* 生成图片View
*/
private RelativeLayout createImageLayout() {
RelativeLayout layout = (RelativeLayout) inflater.inflate(R.layout.edit_image_view, null);
layout.setTag(viewTagIndex++);
View closeView = layout.findViewById(R.id.image_close);
//closeView.setVisibility(GONE);
closeView.setTag(layout.getTag());
closeView.setOnClickListener(btnListener);
return layout;
}
示例14: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup viewGroup) {
GridViewHolder holder = null;
if(convertView == null){
convertView = LayoutInflater.from(mContext).inflate(R.layout.rl_photo_gridview_item,viewGroup,false);
holder = new GridViewHolder(convertView);
convertView.setTag(holder);
}else {
holder = (GridViewHolder) convertView.getTag();
}
OvLoad ovLoad = new OvLoad();
if(position != 0){
String path = (String) mData.get(position);
ovLoad.loadPicture(mActivity,path,holder.mImg);
}else {
//位置0 加载本地资源文件
int itemPath = (int) mData.get(position);
GlideApp.with(mContext)
.load(itemPath)
.transition(new DrawableTransitionOptions().crossFade(200))
.centerCrop()
.into(holder.mImg);
}
return convertView;
}
示例15: getView
import android.view.View; //导入方法依赖的package包/类
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
ReviewAdapter.PlanetHolder holder = new ReviewAdapter.PlanetHolder();
final Review p = planetList.get(position);
// First let's verify the convertView is not null
if (convertView == null) {
// This a new view we inflate the new layout
LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
final View v2 = inflater.inflate(R.layout.item_review, null);
v2.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
// Toast.makeText(v2.getContext(),"User: "+p.getUser(),Toast.LENGTH_LONG).show();
Intent toReviewWeGo = new Intent(v2.getContext(), ReviewActivity.class);
toReviewWeGo.putExtra("Media ID",p.getMediaId());
toReviewWeGo.putExtra("Review ID",p.getId());
v2.getContext().startActivity(toReviewWeGo);
}
});
// Now we can fill the layout with the right values
TextView user = (TextView) v2.findViewById(R.id.txtvUser);
TextView date = (TextView) v2.findViewById(R.id.txtvDate);
TextView rate = (TextView) v2.findViewById(R.id.txtvRating);
holder.userView = user;
holder.dateView = date;
holder.ratingView = rate;
v2.setTag(holder);
v = v2;
}
else {
holder = (ReviewAdapter.PlanetHolder) v.getTag();
}
holder.userView.setText(p.getUser());
holder.dateView.setText(dateFormat.format(p.getDate()));
holder.ratingView.setText(p.getRating()+"");
if (position%2==0)
v.setBackgroundColor(Color.LTGRAY);
else
v.setBackgroundColor(Color.WHITE);
return v;
}