横向模式视频活动正在重启

时间:2012-05-22 21:15:52

标签: android video landscape

我在我的应用中播放视频,视频应该播放纵向和横向模式,重新启动动作,请任何可以举例说明的链接。

  • 使用视频观看视频。

    public class PlayVideoActivity extends Activity {
    
    private VideoView video;
    private ImageButton back;
    
    
    
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);  
        setContentView(R.layout.main);
    
    
        back = (ImageButton)findViewById(R.id.backbutton);
        back.setOnClickListener(new View.OnClickListener() {
    
            public void onClick(View arg0) {
    
                finish();
            }
        });
    
        video=(VideoView)findViewById(R.id.videoView);
    
    
    
        video.setDrawingCacheEnabled(true);
        video.setDrawingCacheQuality(VideoView.DRAWING_CACHE_QUALITY_HIGH);
    
        video.setVideoURI(Uri.parse("android.resource://"+ getPackageName() +"/" + R.raw.fillings_class_1));
        video.requestFocus();
        video.setMediaController(new MediaController(this));
        video.start();
    
    }
    
    
       @Override
       public void onRestoreInstanceState(Bundle savedInstanceState) {
           super.onRestoreInstanceState(savedInstanceState);
           //restore the relevant information
    
       }
    
    
    
    }
    

1 个答案:

答案 0 :(得分:0)

如果您确实需要阻止在方向更改时重新启动活动,则需要在清单中为活动设置configChanges属性以包含orientation