我希望我的飞溅活动支持垂直和水平方向。支持方向支持的飞溅活动
飞溅活动的代码如下splash.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal|center_vertical"
android:background="@drawable/splash_bg"
>
</LinearLayout>
的
public class Splash extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Thread timer = new Thread(){
public void run() {
try{
sleep(5000);
}catch(InterruptedException e){
e.printStackTrace();
}finally{
Intent ARCActivityIntent = new Intent("com.ex.rc.LISTSCREEN");
startActivity(ARCActivityIntent);//
finish();
}
}};
timer.start();
}
}
代码,但问题是 - LISTSCREEN活动是重新创建的时间方向改变号码。
帮助我。
也不要忘记加上'机器人:configChanges =“方向”'的Splash在AndroidManifest.xml – OleGG 2012-01-29 11:48:16
活动说明@穆罕默德纳比尔 - 阿里夫感谢。 +1为您的建议,但我不想使用onConfigurationChanged方法和两个不同的图像。我希望单个图像在方向改变时旋转,我已经完成了。你可以在日食中检查它。我想要避免的唯一问题是在定位更改上重新创建LISTSCREEN活动。 – Vivek 2012-01-29 11:55:59
在splashActivity的清单中添加android:screenOrientation =“portrait”。这将限制方向仅限于景观。所以活动不会被重新创建。 – 2012-01-29 12:13:52