如何自定义view布局,然后添加到LinearLayout中

来源:互联网 发布:linux交叉编译工具链 编辑:程序博客网 时间:2024/06/05 10:17

View view = LayoutInflater.from(activity).inflate(R.layout.dialog_update_prompt,null);

((TextView) view.findViewById(R.id.dialog_update_tv_title)).setText(activity        .getString(R.string.update_find_new_version) + update.content.versionInfo);((TextView) view.findViewById(R.id.dialog_update_tv_content)).setText(msg);
dialog.setCancelBtnText(R.string.cancel).setConfirmBtnText(R.string.update_immediately)        .setDialogContentView(view)                         //通过这个方法添加到layout布局中
//下面为添加view的方法
public CommonDialog setDialogContentView(View contentView) {    if(contentView.getParent() == null) {        this.contentLayout.addView(contentView);    }    return this;}
//改layout为布局
protected RelativeLayout contentLayout;


 

0 0