android动态全屏切换
2013-03-05 10:55
197 查看
import android.app.Activity; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.view.WindowManager; import android.widget.Button; public class FullScreenTestActivity extends Activity { private Button button; private boolean isFulllScreen; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button) findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { isFulllScreen = !isFulllScreen; if (isFulllScreen) { button.setText("exit_full_screen"); WindowManager.LayoutParams params = getWindow().getAttributes(); params.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN; getWindow().setAttributes(params); getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } else { button.setText("full_screen"); WindowManager.LayoutParams params = getWindow().getAttributes(); params.flags &= (~WindowManager.LayoutParams.FLAG_FULLSCREEN); getWindow().setAttributes(params); getWindow().clearFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS); } } }); } }
相关文章推荐
- android动态全屏切换
- android动态全屏切换
- (转) Android 全屏控制:动态切换全屏和非全屏
- Android 编程下应用全屏和非全屏的动态切换解决方案
- Android 动态切换全屏和非全屏模式
- android动态全屏切换
- Android 必知必会 - 动态切换着色模式和全屏模式
- Android动态切换全屏和非全屏
- Android 动态切换全屏和非全屏模式
- android应用全屏模式的切换
- Android动态的全屏和退出全屏
- Android实现动态切换横竖屏,保存横竖屏数据(用Preference存储)
- android中动态实现全屏和动态退出全屏方法
- Android动态全屏与退出全屏
- Android VideoView播放视频竖屏切换横屏有黑白边无法全屏
- Android视频的全屏切换
- Android动态全屏与退出全屏
- android 全屏切换到非全屏 页面抖动
- Android全屏切换到非全屏界面的视觉问题
- 全屏与非全屏动态切换的正确方式