需要另外建立一个welcome.xml布局,可以在layout下,只需要将背景换成导入的图片即可,代码如下

android:layout_width="match_parent"

android:layout_height="match_parent"

android:orientation="vertical"

android:background="@drawable/welcome">

新建个welcome.java中写入:

public class welcome extends Activity {

@Override

protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.welcome);

new Timer().schedule(new TimerTask() {

@Override

public void run() {

// TODO Auto-generated method stub

startActivity(new Intent(welcome.this,MainActivity.class));

finish();

}

},3000);

}

}

另一种写法

在AndroidManifest.xml中的

android:name="com.example.welcome.welcome"

>

android:theme="@android :style/Theme.NoTitleBar.Fullscreen"

这句话可以加在

android:allowBackup="true"

android:icon="@drawable/ic_launcher"

android:label="@string/app_name"

android:theme="@android :style/Theme.NoTitleBar.Fullscreen">

下面可以删掉下一个activity的

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐