第一视图窗口
<?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"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/beijing"/> </LinearLayout>
实现代码——延时跳转
package com.hanqi.lianxi; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import java.util.Timer; import java.util.TimerTask; public class qqActivity2 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.layout_qq2); final Intent localIntent = new Intent(this,qqActivity.class); Timer Timer = new Timer(); TimerTask tast = new TimerTask() { @Override public void run() { startActivity(localIntent); } }; Timer.schedule(tast,4000); } }
实现效果图:
第二视图窗口
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="com.hanqi.lianxi.qqActivity" android:orientation="vertical" android:weightSum="1"> <ImageView android:layout_width="match_parent" android:layout_height="wrap_content" android:src="@drawable/qq2"/> <Spinner android:layout_width="match_parent" android:layout_height="50dp" android:id="@+id/sp_1" android:singleLine="true" ></Spinner> <EditText android:layout_width="match_parent" android:layout_height="50dp" android:hint="密码" android:textSize="15dp" android:password="true" android:singleLine="true" /> <Button android:layout_width="match_parent" android:layout_height="50dp" android:text="登录" android:background="@drawable/lanse" android:layout_marginTop="20dp" android:textSize="10pt" android:id="@+id/dl" android:onClick="bl_OnClick"/> </LinearLayout>
<?xml version="1.0" encoding="utf-8"?> <EditText xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="50dp" android:textSize="15dp" android:hint="账号" android:numeric="integer"> </EditText>
实现代码
package com.hanqi.lianxi; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Spinner; import android.widget.Toast; public class qqActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_qq); String[] strings = {"728664121","1132143009","1186364571","1847593021","92718287187",}; ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this,R.layout.layout_qq,strings); Spinner sp_1 = (Spinner)findViewById(R.id.sp_1); sp_1.setAdapter(arrayAdapter); sp_1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView<?> parent, View view, int position, long id) { } @Override public void onNothingSelected(AdapterView<?> parent) { Toast.makeText(qqActivity.this, "账号不能为空", Toast.LENGTH_SHORT).show(); } }); } public void bl_OnClick(View v) { Intent intent = new Intent(this,qqActivity3.class); startActivity(intent); Toast.makeText(qqActivity.this, "登陆成功,请稍后……", Toast.LENGTH_SHORT).show(); } }
实现效果:
第三视图窗口
<?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"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/img"/> </LinearLayout>
实现代码
package com.hanqi.lianxi; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import java.util.Timer; import java.util.TimerTask; public class qqActivity3 extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_qq3); Timer Timer = new Timer(); TimerTask tast = new TimerTask() { @Override public void run() { } }; } }
实现效果图