Ich möchte Fragment Layout-Taste klicken Sie auf Aktivität. Wenn ich dies tue, wird es erfolgreich zu dem Fragment umgeleitet, aber das Fragmentlayout überlappt mit dem Aktivitätslayout. Bitte hilf mir.laden Fragment von Activity Layouts überlappend
Dies ist meine Aktivität Layout
<RelativeLayout 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"
tools:context="info.androidhive.materialtabs.fragments.OneFragment">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="50dp"
android:id="@+id/linearLayout7"
android:layout_alignTop="@+id/linearLayout6"
android:layout_toEndOf="@+id/linearLayout6">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView14"
android:layout_marginLeft="25dp"
android:layout_marginTop="1dp"
android:layout_marginRight="10dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView15"
android:layout_marginLeft="200dp" />
</LinearLayout>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
Das ist mein Fragment Layout
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
tools:context="info.androidhive.materialtabs.fragments.OneFragment">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="three"
android:textSize="40dp"
android:textStyle="bold"
android:id="@+id/Add"
android:layout_centerInParent="true"/>
Das ThreeFragment Fragment und in Aktivität innerhalb Taste erstreckt klicken dies ist, wie ich Laden Sie das Fragment. Es treten keine Fehler auf, nur die Ansichten überlappen sich.
AddPlan.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
Fragment fragment = new FourFragment();
fragmentTransaction.add(R.id.fragment_container, fragment);
fragmentTransaction.commit();
}
});
Set Hintergrund zu den Layouts wird es den Trick für Sie tun –
ich versucht habe, aber nicht das, was ich will, ich will ganz die Aktivität Layout ersetzen von Fragment –
@SiluniUpeksha Dann ersetzen Sie verwenden stattdessen während Fragment Transaktion hinzuzufügen. –