K
K
Ksernik2016-05-16 10:48:00
Android
Ksernik, 2016-05-16 10:48:00

How to achieve overlapping of part of the content of one fragment with another fragment?

We have: two fragments
1) List fragment
2) Detail fragment
Created and replaced dynamically ..
in the markup:

<LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:id="@+id/linear_layout_container"
            >

            <FrameLayout
                android:id="@+id/leftFragmentContainer"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight=".4"
                />

            <FrameLayout
                android:id="@+id/rightFragmentContainer"
                android:layout_width="0dp"
                android:layout_height="match_parent"
                android:layout_weight=".6"
                />

        </LinearLayout>

It is necessary that a fragment of details overlaps a fragment of the list, overlapping part of the content *and not narrow the fragment of the litt*
Conditional example in pictures:
Fragment of the list
1e44032d6fcd4b29be006f97dca43ff6.png
Fragment of details
5f7a3c66752b4f988b51c507a5014b79.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lazard105, 2016-05-16
@Ksernik

Maybe so:

<FrameLayout
        android:id="@+id/linear_layout_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        >

        <FrameLayout
            android:id="@+id/leftFragmentContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

        <FrameLayout
            android:id="@+id/rightFragmentContainer"
            android:layout_width="match_parent"
            android:layout_gravity="top|left"
            android:layout_height="match_parent"
            android:layout_marginLeft="250dp"
            />

    </FrameLayout>

or so
<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/leftFragmentContainer"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>


    <LinearLayout
        android:id="@+id/linear_layout_container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="horizontal"
        >

        <View
            android:id="@+id/stubView"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight=".4"
            />

        <FrameLayout
            android:id="@+id/rightFragmentContainer"
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight=".6"
            />

    </LinearLayout>
</FrameLayout>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question