Глупая кнопка bug.back фрагмента - PullRequest
0 голосов
/ 29 марта 2012

Фрагмент расстроил меня!Есть три фрагмента, фрагмент [A] -> [B] -> [C]. Используйте замену (id, фрагмент), чтобы изменить текущий вид`,

First.I start page A(add to back),then B(dont add to back),
     then C(add to back).

Second.In Fragment C,press back button.The FragmentA is showing.

Third.when I click somewhere in FragmentA .Bug has been happened,
     indeed I could click view in FragmentB(this Fragment is not show!).

Метод обмена My Fragment

 private static void replacefrag(String tag, FragmentTransaction ft, Fragment target, Bundle b, Boolean allowloss, Boolean addtoback) {
        int resId = R.id.mytabcontent;
        if (b != null) {
            b.putAll(b);
            target.setArguments(b);
        }
        if (addtoback) {
            ft.addToBackStack(tag);

        }
        if (tag != null) {
            ft.replace(resId, target, tag);
        } else {
            ft.replace(resId, target);
        }
        ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
        if (allowloss) {
            ft.commitAllowingStateLoss();
        } else {
            ft.commit();
        }
    }

Main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="fill_parent"
              android:layout_height="fill_parent"
        >
    <FrameLayout
            android:id="@+id/mytabcontent"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:background="@color/yellow"
            />
</LinearLayout>

fraga.xml

<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="fill_parent"
                android:background="@color/green_back" android:layout_height="fill_parent">
    <Button
            android:id="@+id/fraga_btn"
            android:layout_height="wrap_content"
            android:layout_width="wrap_content"
            android:text="AAAAAAAAAAA"
            />
</RelativeLayout>

fragb.xml, fragc.xml похож на fraga.xml Есть ли у кого-либо такая же проблема??большой баг? или я что то пропустил?Я пишу демонстрационный проект, чтобы показать эти проблемы. Вы можете загрузить исходный код здесь !

...