本文整理汇总了Java中android.view.View.getTag方法的典型用法代码示例。如果您正苦于以下问题:Java View.getTag方法的具体用法?Java View.getTag怎么用?Java View.getTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.getTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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 = View.inflate(cxt, R.layout.list_cell_diary_detail,
null);
holder.week = (TextView) convertView
.findViewById(R.id.item_diary_detail_week);
holder.content = (TextView) convertView
.findViewById(R.id.item_diary_detail_content);
holder.imageWeek = (ImageView) convertView
.findViewById(R.id.item_diary_detail_img);
convertView.setTag(holder);
} else {
holder = (ViewHolder) convertView.getTag();
}
holder.week.setText(getWeek(position, holder.imageWeek));
holder.content.setText(stripTags(datas.get(position).toString()));
return convertView;
}
示例3: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup viewGroup) {
View v = convertView;
if (v == null) {
CardAdapter cardAdapter = mCardAbles.get(position).onCreateAdapter();
if (cardAdapter != null) {
if (cardAdapter instanceof BaseViewModel)
((BaseViewModel) cardAdapter).setContext(mContext);
v = cardAdapter.getItemView();
if (v != null) {
v.setTag(cardAdapter);
}
}
}
if (v != null) {
Object tagValue = v.getTag();
if (tagValue != null && tagValue instanceof CardAdapter) {
CardAdapter adapter = (CardAdapter) tagValue;
adapter.bindView(v, getItem(position));
}
}
return v;
}
示例4: getView
import android.view.View; //导入方法依赖的package包/类
@SuppressLint({"ResourceAsColor"})
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder vh;
if (convertView == null) {
convertView = UIs.inflate(this.mContext, R.layout.point_item, null);
vh = new ViewHolder(this);
vh.title = (TextView) convertView.findViewById(R.id.point_title);
vh.point = (TextView) convertView.findViewById(R.id.points_letv);
vh.state = (TextView) convertView.findViewById(R.id.point_state);
convertView.setTag(vh);
} else {
vh = (ViewHolder) convertView.getTag();
}
vh.title.setText(((PointBean) this.list.get(position)).rname);
vh.point.setText("+" + ((PointBean) this.list.get(position)).credit);
if (((PointBean) this.list.get(position)).state < ((PointBean) this.list.get(position)).rewardnum) {
vh.state.setText((Integer.parseInt(((PointBean) this.list.get(position)).credit) * ((PointBean) this.list.get(position)).state) + "/" + (Integer.parseInt(((PointBean) this.list.get(position)).credit) * ((PointBean) this.list.get(position)).rewardnum));
} else {
vh.state.setTextColor(2131493377);
vh.state.setText(this.mContext.getString(2131100064));
}
return convertView;
}
示例5: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ItemViewDelegate itemViewDelegate = mItemViewDelegateManager.getItemViewDelegate(mDatas.get(position), position);
int layoutId = itemViewDelegate.getItemViewLayoutId();
ViewHolder viewHolder = null ;
if (convertView == null)
{
View itemView = LayoutInflater.from(mContext).inflate(layoutId, parent,
false);
viewHolder = new ViewHolder(mContext, itemView, parent, position);
viewHolder.mLayoutId = layoutId;
onViewHolderCreated(viewHolder,viewHolder.getConvertView());
} else
{
viewHolder = (ViewHolder) convertView.getTag();
viewHolder.mPosition = position;
}
convert(viewHolder, getItem(position), position);
return viewHolder.getConvertView();
}
示例6: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
String nbr = (String) view.getTag();
if (!TextUtils.isEmpty(nbr)) {
SipProfile acc = mAccountChooserButton.getSelectedAccount();
Intent it = new Intent(Intent.ACTION_CALL);
it.setData(SipUri.forgeSipUri(SipManager.PROTOCOL_CSIP, nbr));
it.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
it.putExtra(SipProfile.FIELD_ACC_ID, acc.id);
startActivity(it);
}
}
示例7: getViewHolderFromView
import android.view.View; //导入方法依赖的package包/类
public static ViewHolderCreator.ViewHolder getViewHolderFromView(@NonNull View view) {
Object holder = view.getTag(R.id.TANGRAM_VIEW_HOLDER_TAG);
if (holder instanceof ViewHolder) {
return (ViewHolder) holder;
}
return null;
}
示例8: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
try {
String url = (String) v.getTag();
if (url != null) {
Uri uri = Uri.parse(url);
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
startActivity(intent);
}
} catch (Exception e) {
Toast.makeText(this, e.getLocalizedMessage(), Toast.LENGTH_LONG).show();
Log.e("Webs", e.getMessage(), e);
}
}
示例9: messageWithTextReceive
import android.view.View; //导入方法依赖的package包/类
/**
* 消息类型之接收的文本消息
*
* @param position
* @param convertView
* @param parent
* @param message
* @return
*/
private View messageWithTextReceive(int position, View convertView, ViewGroup parent, IMMessage message) {
TextReceiveHolder holder;
if (convertView == null) {
convertView = inflateLayout(R.layout.kf5_message_item_with_text_left, parent);
holder = new TextReceiveHolder(convertView);
} else {
holder = (TextReceiveHolder) convertView.getTag();
}
holder.bindData(message, position, getItem(position - 1));
return convertView;
}
示例10: addMarginTopEqualStatusBarHeight
import android.view.View; //导入方法依赖的package包/类
/**
* 为view增加MarginTop为状态栏高度
*
* @param view view
*/
public static void addMarginTopEqualStatusBarHeight(@NonNull View view) {
Object haveSetOffset = view.getTag(TAG_OFFSET);
if (haveSetOffset != null && (Boolean) haveSetOffset) return;
ViewGroup.MarginLayoutParams layoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
layoutParams.setMargins(layoutParams.leftMargin,
layoutParams.topMargin + getStatusBarHeight(),
layoutParams.rightMargin,
layoutParams.bottomMargin);
view.setTag(TAG_OFFSET, true);
}
示例11: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.btn_message_activity:
if (listener != null && view.getTag() instanceof Routine.Type) {
Routine.Type type = (Routine.Type) view.getTag();
Routine routine = new Routine(type);
listener.onStartRoutine(routine);
}
dismissAllowingStateLoss();
break;
}
}
示例12: getView
import android.view.View; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View item = convertView;
Holder holder;
if (item == null) {
item = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_logcat, parent, false);
holder = new Holder(item);
} else {
holder = (Holder) item.getTag();
}
holder.parse(getItem(position));
return item;
}
示例13: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
int position=(int)v.getTag();
Log.d("已被点击","位置:"+position);
Toast.makeText(mContext,"点击了第"+position+"项",Toast.LENGTH_LONG).show();
Intent intent=new Intent(mContext, RecommendInfoActivity.class);
mContext.startActivity(intent);
}
示例14: onClick
import android.view.View; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
MediaItemLayout itemLayout = (MediaItemLayout) v.getTag(R.id.media_layout);
BaseMedia media = (BaseMedia) v.getTag();
if (mMediaConfig.getMode() == BoxingConfig.Mode.MULTI_IMG) {
if (mOnCheckedListener != null) {
mOnCheckedListener.onChecked(itemLayout, media);
}
}
}
示例15: processExposureParams
import android.view.View; //导入方法依赖的package包/类
public static void processExposureParams(HashMap<String, Object> commonInfo, View exposureView, long exposureData, HashMap<String, Object> exposureIndex) {
try {
HashMap<String, Object> viewData = (HashMap<String, Object>) exposureView.getTag(TrackerConstants.VIEW_TAG_PARAM);
String viewName = TrackerUtil.getClickViewName(exposureView);
if (TextUtils.isEmpty(viewName)) {
TrackerLog.d("processExposureParams viewName is null");
return;
}
commitExposureParams(commonInfo, viewName, viewData, exposureData, exposureIndex);
} catch (Throwable th) {
TrackerLog.e("processExposureParams fail," + th.getMessage());
}
}