make a fullScreen in only layout-land android when play videoView

前端 未结 2 1952
再見小時候
再見小時候 2021-01-14 07:04

I\'m creating android app to play liveStream, I added the videoView in my layout.xml and added the folder of layout-land

I want to make the app shows video full scre

2条回答
  •  北荒
    北荒 (楼主)
    2021-01-14 07:39

    try this...

    @Override
        public void onConfigurationChanged(Configuration newConfig) 
        {
            super.onConfigurationChanged(newConfig);
    
    
            if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) 
            {
                setContentView(R.layout.create_job_l);
    
            } 
            else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT)
            {
                setContentView(R.layout.create_job_p);
    
            }
        }
        @Override
        public void onCreate(Bundle savedInstanceState)
        {
    
            super.onCreate(savedInstanceState);
            if (getResources().getConfiguration().orientation == 1)
            {
                setContentView(R.layout.create_job_p);
            }
            if (getResources().getConfiguration().orientation == 2)
            {
                setContentView(R.layout.create_job_l);
            }
    
    
        }
    

提交回复
热议问题