问题描述
我的Android应用程序被配置为只在横向模式下工作,所以我想使电子邮件客户端,这是意图从我的应用程序创建的,是景观了。这可能吗?
下面是我的code:
意向书I =新意图(Intent.ACTION_SEND);
i.setType(文/ XML);
i.putExtra(Intent.EXTRA_EMAIL,新的String [] {[email protected]});
i.putExtra(Intent.EXTRA_SUBJECT,反馈);
i.putExtra(Intent.EXTRA_TEXT,);
尝试{
意向chooser_intent = Intent.createChooser(我,发送电子邮件);
startActivity(chooser_intent);
}赶上(android.content.ActivityNotFoundException前){
Toast.makeText(getApplicationContext(),E-mail客户端找不到,Toast.LENGTH_LONG).show();
}
这是不可能指定一个活动的方向,如果是外在于你的应用程序。如果活动是本地到您的应用程序(也就是在你自己的清单文件中定义) - 那么你可以有指定的方向
底线是,你无法控制,是不是一个应用程序的方向你自己的(即通过系统的意图调用)。
My Android app is configured to work on landscape mode only, so I want to make e-mail client, which is created by intent from my app, be landscape too. Is it possible?
Here is my code:
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("text/xml");
i.putExtra(Intent.EXTRA_EMAIL, new String[]{"[email protected]"});
i.putExtra(Intent.EXTRA_SUBJECT, "Feedback");
i.putExtra(Intent.EXTRA_TEXT, "");
try {
Intent chooser_intent = Intent.createChooser(i, "Send e-mail");
startActivity(chooser_intent);
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(getApplicationContext(), "E-mail client not found", Toast.LENGTH_LONG).show();
}
It is not possible to specify the orientation of an Activity, if it is external to your app. If an Activity is local to your app (ie. defined in your own Manifest file) - then you could specify the orientation there.
Bottom line, you can not control the orientation of an Application that is not your own (ie. called via system Intent).
这篇关于Android的屏幕方向的意图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!