1

如您所见,我无法在 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;
}


}
4

0 回答 0