2010-01-22 5 views
9

VideoView를 통해 어떤보기를 넣을 수 있습니까? (즉, vimeo에서와 같이 비디오 위에 컨트롤 버튼을 놓습니다.) FrameLayout을 사용하여이 작업을 수행하려고 시도하지만, 방법을 찾지 못했고, 내가하려고하는 작업이 단순히 가능하지 않은지 확실하지 않습니다.Android에서 VideoView를 통해보기를 올리십시오.

답변

2

RelativeLayout을 사용해도 괜찮습니다. SurfaceView에 대해서도 과 비슷한 레이아웃 집합을 볼 수 있습니다. VideoView 대신에 비디오 재생을 위해 MediaPlayer을 사용합니다. 그러나 차이는 없어야합니다.

6

저는 FrameLayout에서 이런 일을합니다. 필요한 것은 컨트롤이 레이아웃 편집기의 VideoView 아래에 있는지 확인하는 것입니다.

<?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:orientation="vertical" 
    android:background="@color/MenuTextNormal"> 

    <VideoView 
     android:id="@+id/VideoView" 
     android:layout_height="fill_parent" 
     android:layout_width="fill_parent" /> 

    <LinearLayout 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:id="@+id/ControlLayout" 
     android:layout_gravity="bottom|center_horizontal"> 

     <Button 
      android:text="@+id/Button01" 
      android:id="@+id/Button01" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
     <Button 
      android:text="@+id/Button02" 
      android:id="@+id/Button02" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
     <Button 
      android:text="@+id/Button03" 
      android:id="@+id/Button03" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
     <Button 
      android:text="@+id/Button04" 
      android:id="@+id/Button04" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" /> 
    </LinearLayout> 
</FrameLayout> 
+3

그리고 그것은 [이 probelm]에 따른 해결책은 (이므로 I는''VideoView'위한 setZOrderOnTop (true)를 사용하는 경우 http://stackoverflow.com/questions/19650483/video-is-not - 비디오보기 -하지만 나는 그 소리를들을 수있다.) 어떻게 그 위에 뷰를 넣을 수 있을까? – Eido95

+0

맞습니다.'setZOrderOnTop'는 VideoView를 모든 것 위에 만들 것이므로 어떻게 해결할 수 있습니까? –

관련 문제