xml界面布局代码:
1 <?xml version="1.0" encoding="utf-8"?> 2 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 3 xmlns:tools="http://schemas.android.com/tools" 4 android:layout_width="match_parent" 5 android:layout_height="match_parent" 6 android:background="@drawable/bg_start" 7 tools:context=".MainActivity" > 8 9 <TextView 10 android:id="@+id/version" 11 android:layout_width="wrap_content" 12 android:layout_height="wrap_content" 13 android:layout_alignParentBottom="true" 14 android:layout_centerHorizontal="true" 15 android:layout_marginBottom="20dp" 16 android:textColor="#ffffff" /> 17 18 </RelativeLayout>
代码实现:
1 package com.gzcivil.ui; 2 3 import android.app.Activity; 4 import android.os.Bundle; 5 import android.os.Handler; 6 import android.widget.TextView; 7 8 import com.gzcivil.R; 9 import com.gzcivil.ui.login.ActivityLogin; 10 import com.gzcivil.utils.CommonUtil; 11 import com.gzcivil.utils.SysUtils; 12 import com.gzcivil.utils.Utils; 13 14 public class Activity_Start extends Activity { 15 private Handler handler = new Handler(); 16 private TextView mVersion; 17 18 @Override 19 protected void onCreate(Bundle savedInstanceState) { 20 super.onCreate(savedInstanceState); 21 setContentView(R.layout.activity_start); 22 23 SysUtils.IS_LOCK = false; 24 mVersion = (TextView) this.findViewById(R.id.version); 25 mVersion.setText("当前版本:V" + CommonUtil.getVersion(this)); 26 handler.postDelayed(new Runnable() { 27 @Override 28 public void run() { 29 Utils.pushLeftIn(Activity_Start.this, ActivityLogin.class, null); 30 finish(); 31 } 32 }, 3000); 33 34 } 35 36 }