-2

このステートメントでは、コンテンツの意味は何ですか?

fragmentTransaction.replace(android.R.id.content, fragment1); 

これは、Android Developers フラグメントの例の 1 つからのものです。

4

1 に答える 1

0

通常、ViewGroupフラグメントをアタッチするのは です。例えば:

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/fragment_container"
    android:layout_width="match_parent"
    android:layout_height="match_parent" />

このコードは、fragment_containerビューにあるものをnewFragment.

transaction.replace(R.id.fragment_container, newFragment);
于 2013-04-01T19:17:40.967 に答える