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

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;


   
  

你可能感兴趣的:(如何自定义view布局,然后添加到LinearLayout中)