首先创建一个hello world工程。
然后创建一个空的fragment
给fragment_1.xml 加上背景色。
把fragment放进activity_main.xml 显示,指定fragment位置和大小,通过name属性,关联到fragment1.java
结果: