2011-10-12 6 views
2

以下のコードを使用して通知バーとタイトルバーを隠しました。しかし今、私はタッチに応じてこの通知バーとタイトルバーを作成したいと思います。エミュレータの画面に触れると、通知とタイトルバーが表示されます。そのときに私はその通知とタイトルバーを表示する必要があります。オンタッチ中にnotifacationバーとタイトルバーを表示することは可能ですか?

requestWindowFeature(Window.FEATURE_NO_TITLE); 
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, 
       WindowManager.LayoutParams.FLAG_FULLSCREEN); 

これは私のxmlファイル..... main.xml

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout android:orientation="vertical" 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    xmlns:android="http://schemas.android.com/apk/res/android"> 
<Gallery xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/videoGrdVw" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:spacing="60px" 
    android:background="@drawable/bk1" 
    /> 
<LinearLayout 
    android:layout_height="100px" 
    android:id="@+id/Header" 
    android:background="@drawable/images1" 
    android:orientation="horizontal" 
    android:layout_alignParentTop="true" 
    android:layout_width="match_parent"> 

</LinearLayout> 
<LinearLayout 
    android:layout_height="100px" 
    android:layout_width="fill_parent" 
    android:background="@drawable/images2" 
    android:id="@+id/Footer" 
    android:orientation="horizontal" 
    android:layout_alignParentBottom="true" 
    > 
</LinearLayout> 

</RelativeLayout> 

答えて

1

あなたはあなたのメインのレイアウト要素にonTouchListenerを作成する必要があります。

これはします:

  • は、あなたのアプリケーションが
  • がDOWN検出し、このよう

何かがうまくいくUPのタッチイベント占めている画面の全体部分にタッチイベントを取得することを許可します:

mainlayout.setOnTouchListener(new OnTouchListener() { 
     @Override 
      public boolean onTouch(View v, MotionEvent event) { 
      if(event.getAction() == MotionEvent.ACTION_DOWN) { 
       //Code to ENABLE titlebar 
      } 
      else if(event.getAction() == MotionEvent.ACTION_UP) { 
       //Code to DISABLE titlebar 
      } 
      return false; 
    } 
}); 
+0

私の質問が更新されました。この方法を使用していますsetContentView(R.layout.main );どのようにこのコードを使用する..... – balaji

+0

申し訳ありませんが、私はあなたが何を求めているのか分かりません? – WilHall

関連する問題