Android课程设计第六天欢迎界面(跳转)
2017-06-30 21:23
423 查看
注意:课程设计只为完成任务,不做细节描述~
package com.example.myapplication; import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.view.View; import android.widget.TextView; /** * Created by 樱花落舞 on 2017/6/13. */ public class JumpActivity extends Activity { TextView textView; int time=3; Handler handler=new Handler(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.jump); textView= (TextView) findViewById(R.id.textview); handler.postDelayed(runnable,1000); } Runnable runnable=new Runnable() { @Override public void run() { time--; handler.postDelayed(this,1000); textView.setText("+"+time+"s"); if(time==0){ Intent intent = new Intent(JumpActivity.this,TestActivity.class); startActivity(intent); finish(); }else { textView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent=new Intent(JumpActivity.this,TestActivity.class); startActivity(intent); //结束线程 handler.removeCallbacks(runnable); finish(); } }); } } }; }
package com.example.myapplication; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); intent.setClass(MainActivity.this,JumpActivity.class); startActivity(intent); MainActivity.this.finish(); } Intent intent = new Intent(); }
package com.example.myapplication; import android.app.Activity; import android.os.Bundle; import android.support.annotation.Nullable; /** * Created by 樱花落舞 on 2017/6/13. */ public class TestActivity extends Activity { @Override protected void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.empty_activity); } }
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="com.example.myapplication.MainActivity" android:orientation="vertical"> <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:src="@mipmap/bg"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="+3秒" android:id="@+id/text" android:textSize="20dp" android:layout_alignParentRight="true"/> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:background="@mipmap/a"/> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <RelativeLayout 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="@mipmap/bg"/> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/textview" android:textSize="20sp" android:text="+3s" android:layout_alignParentRight="true"/> </RelativeLayout>
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.myapplication"> <application android:allowBackup="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:roundIcon="@mipmap/ic_launcher_round" android:supportsRtl="true" android:theme="@style/AppTheme"> <activity android:name=".MainActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <activity android:name=".JumpActivity" android:label="@string/app_name" > <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".MainActivity"/> </activity> <activity android:name=".TestActivity" android:label="@string/app_name"> <meta-data android:name="android.support.PARENT_ACTIVITY" android:value=".MainActivity"/> </activity> </application> </manifest>
相关文章推荐
- Android课程设计第五天欢迎界面(滑动)和图形选择
- Android欢迎界面动画与跳转
- Android开发首页欢迎界面跳转功能的实现
- Android欢迎界面延迟跳转两种方式
- Android实现欢迎界面的自动跳转
- Android——实现欢迎界面的自动跳转(转)
- Android仿超级课程表的课程界面设计
- Android实现欢迎界面的自动跳转
- Android 欢迎界面四个跳转页(Fragment实现渐变渲染)。
- android初学——登陆界面及跳转设计
- Android简单扫码APP设计——从欢迎、登陆到主功能界面
- 不用线程做Android软件欢迎界面,透明效果,完成后自动跳转
- Android仿超级课程表的课程界面设计
- Android 欢迎界面设计之图片渐隐效果
- Android开发首页欢迎界面跳转功能的实现
- Android欢迎界面(全屏延时自动跳转)
- Android课程设计第二天界面排版
- android仿微信实现欢迎界面、介绍界面及单击按钮跳转到主界面
- Android开发中常用的跳转系统自带界面方法
- Android开发_ViewPager制作欢迎界面