加载子布局 ListView长按子条目给子布局赋值
mListItem.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { @Override public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, long l) { AlertDialog.Builder aler=new AlertDialog.Builder(getActivity()); aler.setTitle("发现新版本"); View view1=LayoutInflater.from(getActivity()).inflate(R.layout.aler_item,null); TextView viewById1 = (TextView) view1.findViewById(R.id.textView3); TextView viewById2 = (TextView) view1.findViewById(R.id.textView4); aler.setView(view1); User user = userList.get(i); viewById1.setText(user.getTitle()); viewById2.setText(user.getDate()); aler.setPositiveButton("立即更新", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); aler.setNegativeButton("暂不更新", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { } }); aler.show(); return false; } });