我没有外观问题但是当它开始时,它什么也没有显示。 我认为只会夸大布局,但我想把我所有的所有内容称为片段类
类PlaceholderFragment:
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = null;
switch (getArguments().getInt(ARG_SECTION_NUMBER)) {
case 1:
rootView = (View) inflater.inflate(R.layout.fragment_first, container, false);
break;
case 2:
rootView = (View) inflater.inflate(R.layout.fragment_second, container, false);
break;
case 3:
rootView = (View) inflater.inflate(R.layout.fragment_third, container, false);
break;
}
return rootView;
}
我的班级FirstFragment:
public class PrimerFragment extends AppCompatActivity {
Location location;
LocationManager locationManager;
LocationListener locationListener;
AlertDialog alert = null;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.fragment_primer);
resultado = (TextView) findViewById(R.id.resultado);
resultado.setText("Hello");
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
}
我知道我的班级不完整但只想尝试为什么什么都不显示。并且甚至不显示Toast。 感谢