Android 设置横屏或竖屏

【Android 设置横屏或竖屏】志不强者智不达,言不信者行不果。这篇文章主要讲述Android 设置横屏或竖屏相关的知识,希望能为你提供帮助。

private void init() {Button landButton = (Button) findViewById(R.id.landbutton); landButton.setOnClickListener(new ClickListenerlandButton()); Button VButton = (Button) findViewById(R.id.Vbutton); VButton.setOnClickListener(new ClickListenerVButton()); }private class ClickListenerlandButton implements OnClickListener { @Override public void onClick(View v) { landScreen(); }} privatevoid landScreen() { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE); //横屏} private class ClickListenerVButton implements OnClickListener { @Override public void onClick(View v) { VScreen(); }} privatevoid VScreen() { setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //竖屏}



    推荐阅读