这是我的片段类:
public class FirstFragment extends Fragment {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
EditText newText = new EditText(getActivity());
newText.setText("This is a fragment");
newText.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
return inflater.inflate(R.layout.fragment_first, container, false);
}
}
我正在尝试添加newText
到正在创建的片段中。