2

我试图找到类似的问题,但不能。

我使用支持库构建基于片段的应用程序。以现代“Google/Facebook”风格设计的 UI(全屏内容页面 + 滑动菜单)。这是主要的布局文件:

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

<FrameLayout
    android:id="@+id/mainmenu_fragment"
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@color/mainmenu_bg" >
</FrameLayout>

<LinearLayout
    android:id="@+id/contentwrapper"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_toRightOf="@id/mainmenu_fragment"
    android:background="@android:color/white"
    android:orientation="vertical" >

    <fragment
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        class="com.pleazzme.Topline"
        android:tag="Topline" />

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

    <FrameLayout
        android:id="@+id/main_selectorline_wrap"
        android:layout_width="match_parent"
        android:layout_height="50dp" >
    </FrameLayout>
</LinearLayout>

<ImageButton
    android:id="@+id/main_btn_wallet"
    android:contentDescription="@string/text_btn_wallet"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:background="@android:color/transparent"
    android:src="@drawable/wallet"
    android:layout_alignParentRight="true"
    android:layout_alignParentBottom="true"
    android:onClick="showWallet" />

</RelativeLayout>

这是片段布局之一:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/topline_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@drawable/topline_tilebg" >

<ImageView
    android:id="@+id/topline_title"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:adjustViewBounds="true"
    android:layout_centerHorizontal="true"
    android:contentDescription="@string/text_topline_title"
    android:paddingBottom="10dp"
    android:paddingLeft="5dp"
    android:paddingRight="5dp"
    android:paddingTop="10dp"
    android:src="@drawable/pleazzme_title" />

<Button
    android:id="@+id/counter_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_toRightOf="@id/topline_title"
    android:background="@drawable/topline_newscounter"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:textColor="@android:color/white"
    android:visibility="gone" />

<Button
    android:id="@+id/topline_back_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:background="@drawable/back_but"
    android:contentDescription="@string/text_back_button"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:onClick="onBackTrigger"
    android:text="@string/btn_back"
    android:textColor="@color/android:white"
    android:visibility="gone" />

<ImageButton
    android:id="@+id/topline_mainmenu_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerVertical="true"
    android:layout_margin="5dip"
    android:layout_toRightOf="@id/topline_back_button"
    android:background="@drawable/sq_but_bg"
    android:contentDescription="@string/text_mainmenu_button"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:onClick="onMainmenuTrigger"
    android:src="@drawable/ico_list" />

<ImageButton
    android:id="@+id/topline_map_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentRight="true"
    android:layout_centerVertical="true"
    android:layout_margin="5dip"
    android:background="@drawable/sq_but_bg"
    android:contentDescription="@string/text_map_button"
    android:focusable="false"
    android:focusableInTouchMode="false"
    android:onClick="onMapTrigger"
    android:src="@drawable/ico_mark" />

</RelativeLayout>

活动 onMapTrigger 方法:

public void onMainmenuTrigger(View v) {
     FragmentTransaction ft = fm.beginTransaction();
     ft.setCustomAnimations(R.anim.left_to_right, R.anim.right_to_left);

    if (mml.isHidden()) {
        mml.clearSearch();
         ft.show(mml);
    } else {
         ft.hide(mml);
    }
     ft.commit();
}

显示动画:

<set xmlns:android="http://schemas.android.com/apk/res/android" >

<translate
    android:duration="500"
    android:fromXDelta="-100%p"
    android:toXDelta="0" />

</set>

显示菜单时,可见的顶线按钮会重叠。有人可以告诉我,在这种情况下有什么问题?

4

1 回答 1

0

我发现解决这个问题的唯一方法是使用NineOldAndroids库重构我的动画。他们对 sdk < 11 有一些问题,但它的工作。

于 2012-12-06T11:33:56.183 回答