Android------横屏显示
2中方法:
(1)修改xml
android:screenOrientation="landscape"
(2)修改Activity
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
举例:
public class MainActivity extends Activity
{
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
textView = (TextView)findViewById(R.id.text);
textView.setText("111111111111111111111111111111111111111111111111111111111111111111111111111");
}
@Override
public boolean onCreateOptionsMenu(Menu menu)
{
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.main, menu);
return true;
}
}
效果:
3639

被折叠的 条评论
为什么被折叠?



