[Android Studio] การเล่นกับ Fragment อย่างง่าย

Huzen Karode
Sep 1, 2018 · 1 min read
ตัวอย่างการเพิ่ม Fragment Map

ขั้นตอนการทำ

  1. สร้าง Fragment (ในตัวอย่างเป็นการสร้าง Fragment Map)
SupportMapFragment mapFragment = new SupportMapFragment();

2. เรียก FragmentTransaction

FragmentTransaction ft = getSupportFragmentManager().beginTransaction();

3. ทำการ replace และ commit

ft.replace(R.id.map, mapFragment);
ft.commit();
Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade