當前位置: 首頁>>代碼示例>>Java>>正文


Java View.setTag方法代碼示例

本文整理匯總了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;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:ChannelAdapter.java

示例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;
  }
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:23,代碼來源:RedBoxDialog.java

示例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;
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:23,代碼來源:FactAdapter.java

示例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;
}
 
開發者ID:stytooldex,項目名稱:pius1,代碼行數:18,代碼來源:MainActivity.java

示例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;
}
 
開發者ID:BaoBaoJianqiang,項目名稱:AndroidNetwork,代碼行數:22,代碼來源:CinemaAdapter.java

示例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;
}
 
開發者ID:Visions-Team,項目名稱:eBread,代碼行數:18,代碼來源:SettingListAdapter.java

示例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);
        }
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:31,代碼來源:BaseItemDraggableAdapter.java

示例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;
}
 
開發者ID:AndroidBoySC,項目名稱:Mybilibili,代碼行數:15,代碼來源:CBPageAdapter.java

示例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);
    }
}
 
開發者ID:TeamBrainStorm,項目名稱:SimpleUILauncher,代碼行數:11,代碼來源:Workspace.java

示例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();
}
 
開發者ID:sunyabin,項目名稱:FlycoTablayout,代碼行數:14,代碼來源:SegmentTabLayout.java

示例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;
 	}
 
開發者ID:Welloculus,項目名稱:MobileAppForPatient,代碼行數:35,代碼來源:SearchMeterDialog.java

示例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;
                }
            }
        }
    }
}
 
開發者ID:PSD-Company,項目名稱:duo-navigation-drawer,代碼行數:39,代碼來源:DuoMenuView.java

示例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;
}
 
開發者ID:yangchong211,項目名稱:YCCustomText,代碼行數:13,代碼來源:HyperTextEditor.java

示例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;
}
 
開發者ID:funnyzhaov,項目名稱:Tribe,代碼行數:29,代碼來源:PhotoGridViewAdapter.java

示例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;
    }
 
開發者ID:NonlinearFruit,項目名稱:Retrospector-Android,代碼行數:50,代碼來源:ReviewAdapter.java


注:本文中的android.view.View.setTag方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。