本文整理汇总了Java中com.mob.tools.gui.AsyncImageView.setId方法的典型用法代码示例。如果您正苦于以下问题:Java AsyncImageView.setId方法的具体用法?Java AsyncImageView.setId怎么用?Java AsyncImageView.setId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.mob.tools.gui.AsyncImageView
的用法示例。
在下文中一共展示了AsyncImageView.setId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import com.mob.tools.gui.AsyncImageView; //导入方法依赖的package包/类
public static RelativeLayout create(Context context) {
SizeHelper.prepare(context);
RelativeLayout root = new RelativeLayout(context);
root.setId(ResHelper.getIdRes(context, "rl_lv_item_bg"));
AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT,
SizeHelper.fromPxWidth(95));
root.setLayoutParams(params);
int padding = SizeHelper.fromPxWidth(14);
root.setPadding(padding, padding, padding, padding);
root.setGravity(Gravity.CENTER_VERTICAL);
root.setBackgroundColor(0xffffffff);
AsyncImageView contactImage = new AsyncImageView(context);
contactImage.setId(ResHelper.getIdRes(context, "iv_contact"));
RelativeLayout.LayoutParams contactImageParams = new RelativeLayout.LayoutParams(SizeHelper.fromPxWidth(64),
SizeHelper.fromPxWidth(64));
contactImageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
contactImage.setLayoutParams(contactImageParams);
contactImage.setScaleType(ScaleType.FIT_CENTER);
root.addView(contactImage);
LinearLayout wrapper = new LinearLayout(context);
RelativeLayout.LayoutParams wrapperParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
wrapperParams.addRule(RelativeLayout.RIGHT_OF, ResHelper.getIdRes(context, "iv_contact"));
wrapperParams.addRule(RelativeLayout.CENTER_VERTICAL);
wrapperParams.leftMargin = SizeHelper.fromPxWidth(12);
wrapper.setLayoutParams(wrapperParams);
wrapper.setOrientation(LinearLayout.VERTICAL);
root.addView(wrapper);
TextView name = new TextView(context);
name.setId(ResHelper.getIdRes(context, "tv_name"));
LinearLayout.LayoutParams nameParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
name.setLayoutParams(nameParams);
name.setTextColor(0xff333333);
name.setTextSize(TypedValue.COMPLEX_UNIT_PX,SizeHelper.fromPxWidth(28));
wrapper.addView(name);
TextView contact = new TextView(context);
contact.setId(ResHelper.getIdRes(context, "tv_contact"));
LinearLayout.LayoutParams contactParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT);
contact.setLayoutParams(contactParams);
contact.setTextColor(0xff999999);
contact.setTextSize(TypedValue.COMPLEX_UNIT_PX,SizeHelper.fromPxWidth(22));
wrapper.addView(contact);
Button add = new Button(context);
add.setId(ResHelper.getIdRes(context, "btn_add"));
RelativeLayout.LayoutParams addParams = new RelativeLayout.LayoutParams(SizeHelper.fromPxWidth(92),
SizeHelper.fromPxWidth(46));
addParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
addParams.addRule(RelativeLayout.CENTER_VERTICAL);
add.setLayoutParams(addParams);
int resid = ResHelper.getStringRes(context, "smssdk_add_contact");
add.setText(resid);
add.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(22));
add.setTextColor(0xff797979);
//resid = R.getBitmapRes(context, "smssdk_corners_bg");
add.setBackgroundDrawable(DrawableHelper.createCornerBg(context));
add.setPadding(0, 0, 0, 0);
root.addView(add);
return root;
}
示例2: create
import com.mob.tools.gui.AsyncImageView; //导入方法依赖的package包/类
public static RelativeLayout create(Context context) {
SizeHelper.prepare(context);
RelativeLayout root = new RelativeLayout(context);
root.setId(Res.id.rl_lv_item_bg);
AbsListView.LayoutParams params = new AbsListView.LayoutParams(AbsListView.LayoutParams.MATCH_PARENT, SizeHelper.fromPxWidth(95));
root.setLayoutParams(params);
int padding = SizeHelper.fromPxWidth(14);
root.setPadding(padding, padding, padding, padding);
root.setGravity(Gravity.CENTER_VERTICAL);
root.setBackgroundColor(0xffffffff);
AsyncImageView contactImage = new AsyncImageView(context);
contactImage.setId(Res.id.iv_contact);
RelativeLayout.LayoutParams contactImageParams = new RelativeLayout.LayoutParams(SizeHelper.fromPxWidth(64),SizeHelper.fromPxWidth(64));
contactImageParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
contactImage.setLayoutParams(contactImageParams);
contactImage.setScaleType(ScaleType.FIT_CENTER);
root.addView(contactImage);
LinearLayout wrapper = new LinearLayout(context);
RelativeLayout.LayoutParams wrapperParams = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
wrapperParams.addRule(RelativeLayout.RIGHT_OF, Res.id.iv_contact);
wrapperParams.addRule(RelativeLayout.CENTER_VERTICAL);
wrapperParams.leftMargin = SizeHelper.fromPxWidth(12);
wrapper.setLayoutParams(wrapperParams);
wrapper.setOrientation(LinearLayout.VERTICAL);
root.addView(wrapper);
TextView name = new TextView(context);
name.setId(Res.id.tv_name);
LinearLayout.LayoutParams nameParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
name.setLayoutParams(nameParams);
name.setTextColor(0xff333333);
name.setTextSize(TypedValue.COMPLEX_UNIT_PX,SizeHelper.fromPxWidth(28));
wrapper.addView(name);
TextView contact = new TextView(context);
contact.setId(Res.id.tv_contact);
LinearLayout.LayoutParams contactParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT,LinearLayout.LayoutParams.WRAP_CONTENT);
contact.setLayoutParams(contactParams);
contact.setTextColor(0xff999999);
contact.setTextSize(TypedValue.COMPLEX_UNIT_PX,SizeHelper.fromPxWidth(22));
wrapper.addView(contact);
Button add = new Button(context);
add.setId(Res.id.btn_add);
RelativeLayout.LayoutParams addParams = new RelativeLayout.LayoutParams(SizeHelper.fromPxWidth(92),SizeHelper.fromPxWidth(46));
addParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
addParams.addRule(RelativeLayout.CENTER_VERTICAL);
add.setLayoutParams(addParams);
int resid = R.getStringRes(context, "smssdk_add_contact");
add.setText(resid);
add.setTextSize(TypedValue.COMPLEX_UNIT_PX, SizeHelper.fromPxWidth(22));
add.setTextColor(0xff797979);
//resid = R.getBitmapRes(context, "smssdk_corners_bg");
add.setBackgroundDrawable(DrawableHelper.createCornerBg(context));
add.setPadding(0, 0, 0, 0);
root.addView(add);
return root;
}