<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.example.tutorial.MainActivity" >
<com.example.tutorial.PreviewPlayer
android:id="@+id/ppPlayer"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:id="@+id/btnPlay"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:id="@+id/btnPauseVideo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<Button
android:id="@+id/btnStopVideo"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</FrameLayout>
===================================================================
@Override
protected void onCreate( Bundle savedInstanceState ) {
super.onCreate( savedInstanceState );
setContentView( R.layout.activity_main );
ppPlayer = (PreviewPlayer) findViewById( R.id.ppPlayer );
btnPlay = (Button) findViewById( R.id.btnPlay );
btnPauseVideo = (Button) findViewById( R.id.btnPauseVideo );
btnStopVideo = (Button) findViewById( R.id.btnStopVideo );
btnPlay.setOnClickListener( this );
btnPauseVideo.setOnClickListener( this );
btnStopVideo.setOnClickListener( this );
}
@Override
public void onClick( View v ) {
switch ( v.getId() ) {
case R.id.btnPlay:
ppPlayer.playVideo( videoFileName );
break;
case R.id.btnPauseVideo:
ppPlayer.pauseVideo();
break;
case R.id.btnStopVideo:
ppPlayer.stopVideo();
break;
}
}
framelayout 잘 몰라서 질문드려요!
아래부터 위로 차례대로 쌓여진다고하는데
그러면 위의 코드같은 경우
맨위에 player 맨아래에 보이는건 btnstopvideo인가요?
저걸 실행하면 꽉차게 까만화면 보이고 클릭하면 꺼지더라구요 ㅠㅠ
시작버튼을 아래로 내려도 마찬가지 ㅠㅠ
이게 layout문젠지 단순히 play구현을 잘못한건지 모르겟어서 ㅎㅎ..ㅠ
제가 만들고 싶은 것은
videoplayer가 화면꽉차게! 계속 보이고요
클릭하면 시작,중지,정지가 되었으면 하는데
button 코드를 previewplaye위로 올리면
button cannot be cast previewplayer라는 에러가 뜨더라구요 ㅠㅠ
어떤식으로해야하죠? framelayout을 쓰면안되나요?ㅠㅠ
play의 문제인가요..?
그리고 저 코드에 이상이없다면
처음클릭은 play 두번째클릭은 pause 세번째클릭은 stop이 되는건가요?