ste*_*ong 5 android screen-orientation android-virtual-device android-emulator
我创建了一个虚拟的Android设备,480x800运行它,并且因为我已经找到了如何更改屏幕orientation(纵向横向,CTRL+F11/ CTRL+F12/ KP7/ KP9),我使用这些键来更改orientation.
但是当我尝试其中一个键时,虚拟屏幕会旋转90度,但方向不会改变.因此,按钮垂直放置在屏幕上,所有文本也是如此.就像一张旋转90度的照片.
如何让虚拟学位实际切换到其他布局文件(/res/layout-land/activity_entry.xml)?Eclipse的图形查看器可以landscape/portrait正确切换.
编辑
我在此onCreateOptionsMenu(Menu menu)
方法下的活动中添加了此部分,但应用程序无法识别屏幕方向更改:
@Override
public void onConfigurationChanged(Configuration newConfig) {
super.onConfigurationChanged(newConfig);
Context context = getApplicationContext();
CharSequence text = "Orientation changed";
int duration = Toast.LENGTH_SHORT;
Toast toast = Toast.makeText(context, text, duration);
toast.show();
}
Run Code Online (Sandbox Code Playgroud)
编辑2
当我this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE)从onCreate()方法中调用时,它运行良好.
首先关闭数字锁定,然后按7或 按9并检查模拟器的方向是否已更改,更改模拟器方向的其他方法是按ctrl+ f12。
| 归档时间: |
|
| 查看次数: |
6190 次 |
| 最近记录: |