0
我想顯示在我掛了一個「片段佔位符」無法看到片段片段佔位符
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!" />
<FrameLayout android:id="@+id/fragment_placeholder"
android:layout_weight="1"
android:layout_width="match_parent"
android:layout_height="300dp"
android:text="test"
android:layout_below="@+id/text"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true" />
MainActivity.java主要活動片段
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_music) {
TextView t = (TextView) findViewById (R.id.text);
t.setText(R.string.Musikken);
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
ft.add(R.id.fragment_placeholder, new MusicFragment());
ft.commit();
} else if
什麼我在這裏錯了嗎?