Home | 简体中文 | 繁体中文 | 杂文 | Github | 知乎专栏 | Facebook | Linkedin | Youtube | 打赏(Donations) | About
知乎专栏

第 114 章 Fragment

目录

114.1. 启动 Fragment
114.2. 关闭 Fragment
114.3. 在 Fragment 中使用 findViewById
114.4. 在 Fragment 中使用 Intent 跳转
114.5. Fragment 中调用 getPackageManager()
114.6. 在 Fragment 中使用 runOnUiThread
114.7. Fragment 中调用 findViewById
114.8. 替换 FrameLayout
114.9. Fragment 接收 BroadcastReceiver 广播

114.1. 启动 Fragment

		
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="?attr/fullscreenBackgroundColor"
    android:theme="@style/ThemeOverlay.裸眼3D产品.FullscreenContainer"
    tools:context=".ui.PictureBookFullscreenActivity">

    <androidx.fragment.app.FragmentContainerView
        android:id="@+id/fragmentContainerView"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

</FrameLayout>		
		
		
		
 	getSupportFragmentManager()
        .beginTransaction()
        .add(R.id.fragmentContainerView, new PictureBookStoryFullscreenFragment(bookId))
        .commit();