你可以看到我无法在showDialog()之前动态设置edittext的值。 我很困惑 我怎么能这样做?
这是我的对话框代码 什么是问题?
public class Register_DialogFragment extends SherlockDialogFragment {
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder=new AlertDialog.Builder(getSherlockActivity()) ;
LayoutInflater inflater = getSherlockActivity().getLayoutInflater();
final View content = inflater.inflate(R.layout.register_dialog, null);
builder.setView(inflater.inflate(R.layout.register_dialog, null));
return builder.create();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// setStyle(SherlockDialogFragment.STYLE_NO_FRAME, R.style.MyTheme);
View rootView = inflater.inflate(R.layout.register_dialog, container,false);
TelephonyManager telephonyManager = (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.getDeviceId();
EditText mProductTV = (EditText) rootView.findViewById(R.id.txtMobile);
mProductTV.setVisibility(View.VISIBLE);
mProductTV.setText("test");
// Do something else
return null;
}
}