2011-06-21 3 views
0

私は以下を含む全画面のRelativeLayoutを持っています: 1. FrameLayout、フルスクリーン、内容を表示します。 2. LinearLayoutは、コントロールメニューとして機能し、コンテンツ#1の上に留まり、要求に応じてスライドまたはフェードイン/アウトできる必要があります(実際には2つあります。ボトム)。削除するにはTranslateAnimationの後に場所をクリックしますか?

メニュー表示が正しく表示され、メニューボタンが押されたときにメニューコントローラがスライド/フェードイン/フェードアウトします。しかし、スライドしてビューをフェードアウトすると、クリックアクションが残ります。このアクションを削除するにはどうすればよいですか?

私はmenuLayout.setVisibility(View.GONE)を呼び出そうとしました。行動は残っている。

私はTranslateAnimationでいくつかの問題を読んでいますが、動作させることはできません。 誰かが私にこれをどのように修正するのか教えてもらえますか?例が分かるだろう。

XML:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:background="#99000000" 
    android:layout_alignParentLeft="true" 
    android:gravity="center_vertical" 
    android:id="@+id/contentFrame" 
    > 
    <ViewSwitcher 
      android:layout_width="match_parent" 
      android:layout_height="match_parent" 
      android:id="@+id/viewSwitch"> 
     <include layout="@layout/main_car" /> 
    </ViewSwitcher> 
</FrameLayout> 
<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="43dp" 
    android:background="@drawable/um_top_bar" 
    android:layout_alignParentTop="true" 
    android:id="@+id/topMenu" 
    android:gravity="top" 
    > 
    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/um_btn_home" 
     android:id="@+id/homeMainBtn" /> 
    <ImageView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/exp_menu_btn" 
     android:id="@+id/menuMainBtn" /> 
</LinearLayout> 
<LinearLayout 
    android:orientation="vertical" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:background="#FF000000" 
    android:layout_alignParentBottom="true" 
    android:id="@+id/bottomMenu" 
    android:gravity="top" 
    > 
    <include layout="@layout/menu_bottom" /> 
</LinearLayout> 

答えて

1

[OK]を、私はそれが最後で動作するようになりました。同じ問題に直面する可能性のある人は、ここで私がしたことがあります。

空のレイヤーを配置し、すべてのメニューコンテンツを別々のXMLファイルに分けます。

は、ここでは、コードです:

/** Resetting bottom menu content */ 
    private void resetBottomMenu(boolean isOpen){ 

    bottomMenu.removeAllViews(); 
    bottomMenu.addView(loadBottomMenu(isOpen)); 
      // Control event handler goes here. 
    } 

    /** Load bottom menu content from XML */ 
    private LinearLayout loadBottomMenu(boolean isOpen){ 

    LinearLayout result = null; 
    if(isOpen){ 
     result = (LinearLayout)View.inflate(this.getApplicationContext(), R.layout.menu_bottom_open, null); 
    }else{ 
     result = (LinearLayout)View.inflate(this.getApplicationContext(), R.layout.menu_bottom, null); 
    } 
    return result; 
    } 

私は、メニューをスライドするたびに、私はresetBottomMenuが、その後bottomMenu上でアニメーションを開始呼ばれます。メニューを閉じるには、アニメーションを開始してからresetBottomMenuを起動します。

レイアウトで子ビューを削除すると、クリック操作が削除されるため、重要です。

P.S.私はこれが最良の方法であるかどうかはわかりませんが、それが機能することを確認できます。私はフェード/スライドする必要がある3つのメニューを持っており、今は完全に動作しています:)

関連する問題