本文介绍了[开机画面]如何全屏幕显示的图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想打一个启动画面在我的应用程序,我需要知道如何全屏幕显示图像。这可以通过我的XML或Java code做?如何?现在我只是做这样的:
公共类闪屏延伸活动{
私有静态最终诠释STOPSPLASH = 0;
私有静态最后长SPLASHTIME = 5000;
私人处理程序splashHandler =新的处理程序(){
@覆盖
公共无效的handleMessage(信息MSG){
开关(msg.what){
案例STOPSPLASH:
//从视图中删除闪屏
意向意图=新的意图(SplashScreen.this,jetpack.class);
startActivity(意向);
打破;
}
super.handleMessage(MSG);
}
};
@覆盖
公共无效的onCreate(包savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.splash_screen);
消息味精=新的Message();
msg.what = STOPSPLASH;
splashHandler.sendMessageDelayed(味精,SPLASHTIME);
}
}
怎么会这样splash_screen.xml?感谢您的帮助。
解决方案
< XML版本=1.0编码=UTF-8&GT?;
< LinearLayout中的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:方向=垂直
机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT>
< ImageView的机器人:layout_width =FILL_PARENT
机器人:layout_height =FILL_PARENT
机器人:SRC =@可绘制/图像/>
< / LinearLayout中>
和在code添加
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
的setContentView(R.layout.splash_screen)之前;
I want to make a splash screen in my application, for that i need to know how to show an image in full screen. This could me made by XML or Java code ? And how?For now i just made this:
public class SplashScreen extends Activity {
private static final int STOPSPLASH = 0;
private static final long SPLASHTIME = 5000;
private Handler splashHandler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case STOPSPLASH:
//remove SplashScreen from view
Intent intent = new Intent(SplashScreen.this, jetpack.class);
startActivity(intent);
break;
}
super.handleMessage(msg);
}
};
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
Message msg = new Message();
msg.what = STOPSPLASH;
splashHandler.sendMessageDelayed(msg, SPLASHTIME);
}
}
How can be this splash_screen.xml ?Thank you for your help.
解决方案
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<ImageView android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:src="@drawable/image" />
</LinearLayout>
and in the code add
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
before setContentView(R.layout.splash_screen);
这篇关于[开机画面]如何全屏幕显示的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!