zoukankan      html  css  js  c++  java
  • 团队冲刺第九天--校园百晓生(STDeverything)

    摘要:今天添加了启动页的内容,主要是3秒后自动跳转,封面海报等设置。

    代码:

    <?xml version="1.0" encoding="utf-8"?>
    <androidx.constraintlayout.widget.ConstraintLayout 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=".login.Splash">
    
        <ImageView
            android:id="@+id/imageView3"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:scaleType="fitXY"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:srcCompat="@mipmap/fengmian" />
    
        <TextView
            android:id="@+id/splash_tip_text"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginTop="16dp"
            android:layout_marginEnd="16dp"
            android:alpha="0.6"
            android:background="@drawable/splash_text_tip_style"
            android:gravity="center"
            android:textColor="#ffffff"
            android:textSize="18sp"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintTop_toTopOf="parent" />
    
    </androidx.constraintlayout.widget.ConstraintLayout>
    layout
    package com.lh.std_everything.login;
    
    import androidx.annotation.NonNull;
    import androidx.appcompat.app.AppCompatActivity;
    
    import android.content.Intent;
    import android.os.Bundle;
    import android.os.Handler;
    import android.os.Message;
    import android.view.View;
    import android.view.Window;
    import android.widget.TextView;
    
    import com.lh.std_everything.R;
    
    public class Splash extends AppCompatActivity {
    
        private TextView tv;
        private boolean flag=false;
        private int exitNum=3;
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            supportRequestWindowFeature(Window.FEATURE_NO_TITLE);
            setContentView(R.layout.activity_splash);
            tv=findViewById(R.id.splash_tip_text);
    
            Thread thread=new Thread(new Runnable() {
                @Override
                public void run() {
                    while (!flag){
                        runOnUiThread(new Runnable() {
                            @Override
                            public void run() {
                                tv.setText(String.valueOf(exitNum)+"秒后跳转");
                            }
                        });
                        try {
                            Thread.sleep(1000);
                        } catch (InterruptedException e) {
                            e.printStackTrace();
                        }
                        exitNum--;
                        if(exitNum<0)
                            flag=true;
                    }
                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            startActivity(new Intent(Splash.this,Login.class));
                        }
                    });
                }
            });
            thread.start();
            tv.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    flag=true;   //改变退出标志
                }
            });
        }
    
    }
    splash

     界面展示:

  • 相关阅读:
    Python进程池
    Python进程间通信
    python编程中的if __name__ == 'main与windows中使用多进程
    Python进程-实现
    python进程join()函数理解
    python 进程池Pool
    python多进程打印字符,加锁(Lock加锁)
    python进程、多进程
    正则表达式统计字符串中数字的个数
    python 处理xml
  • 原文地址:https://www.cnblogs.com/dd110343/p/12781686.html
Copyright © 2011-2022 走看看