2011-03-09 26 views
0

我想在android中实现视频面板,在其中我想创建一个任务面板,其中包含诸如play,pause之类的命令。我创造了这个布局是如何在android中实现自动隐藏任务面板

<?xml version="1.0" encoding="utf-8"?> 
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:id="@+id/layout"> 
<VideoView 
    android:id="@+id/videoView" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
/> 
<TextView 
    android:id="@+id/timer" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_gravity="top|left" 
    android:textColor="@color/RED" 
    android:text="HI"></TextView> 
    <RelativeLayout 
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content" 
    android:id="@+id/rLayoutCameraButtons" 

    android:layout_gravity="center|bottom"> 
     <SeekBar 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:layout_margin="10px" 
      android:id="@+id/seekbar" 
      android:max="100" 
      android:layout_alignParentTop="true" 
     /> 
     <RelativeLayout 
     android:id="@+id/rlayout_buttons" 
     android:layout_width="fill_parent" 
     android:layout_height="wrap_content" 
     android:layout_below="@+id/seekbar" 
     > 
     <Button 
      android:id="@+id/buttonPlay" 
      android:text="Play" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_centerInParent="true"> 
     </Button> 
     <Button 
      android:layout_alignParentLeft="true" 
      android:id="@+id/buttonStop" 
      android:text="Stop" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content"> 
     </Button> 
     <Button 
      android:id="@+id/buttonPause" 
      android:text="Pause" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:layout_alignParentRight="true" > 
     </Button> 
     </RelativeLayout>   
    </RelativeLayout> 

我想隐藏自动隐藏我的相对布局从上 最后触摸withing 5秒还我想让它出现在触摸上该区域它存在的地方。没有任何想法 PLZ帮助

回答

1

你知道吗MediaController?如果你不需要过多地定制你的面板,这是你正在寻找的简单而优雅的解决方案。你可以简单地开始:

myVideoView.setMediaController(new MediaController(this)); 

Here的的MediaController的例子在3D图库应用程序中使用。

0

一个你可以尝试的方法之一:
1.截取你的活动onTouchEvent承载玩家
2.触摸向UI线程上创建的Handler发布延迟消息,这将隐藏面板的父布局。
3.记住/确定绘制面板的父布局的区域。在Touch内部,写一个逻辑来决定Touch是否发生在感兴趣的区域,如果是,则使面板可见。

希望有所帮助。