zoukankan      html  css  js  c++  java
  • Android:简单的开场界面

    接通过ImageView创建一个全屏的图片:

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical" >
        
    <ImageView 
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:src="@drawable/splash"
        android:scaleType="center"
        />
    </LinearLayout>

     新建activity:

    package com.example.testwelcome;
    
    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    import android.widget.Toast;
    
    public class WelcomeActivity extends Activity{
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.welcome);
            new Handler().postDelayed(new Runnable(){
                @Override
                public void run() {
                    // TODO Auto-generated method stub
                    Intent intent = new Intent(WelcomeActivity.this, MainActivity.class);
                    startActivity(intent);
                    WelcomeActivity.this.finish();
                  
                }
            }, 2000);//两秒后跳转到另一个页面
           
        }
    
    }

    AndroidManifest.xml

    设置默认启动WelcomeActivity,并设置主题为全屏无标题样式

        <application
            android:allowBackup="true"
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name"
            android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" >
            <activity
                android:name="com.example.testwelcome.WelcomeActivity"
                android:label="@string/app_name" >
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
         <activity android:name="com.example.testwelcome.MainActivity"></activity>
        </application>

    >>实例下载

  • 相关阅读:
    Android开源库
    银行卡的数字检測
    hdu4941 Magical Forest
    android之检測是否有网络
    在Oracle数据库中使用NFS,怎样调优?
    centos+nginx+php-fpm+php include fastcgi_params php页面能訪问但空白,被fastcgi_params与fastcgi.conf害慘了
    漫谈反射
    Android 四大组件学习之BroadcastReceiver二
    【LeetCode】two num 利用comparable接口 对对象进行排序
    扩展功能==继承?
  • 原文地址:https://www.cnblogs.com/tinyphp/p/3878765.html
Copyright © 2011-2022 走看看