Android商城開發系列(二)——App啟動歡迎頁面制作

  商城APP一般都會在應用啟動時有一個歡迎界面,下面我們來實現一個最簡單的歡迎頁開發:就是打開商城App,先出現歡迎界面,停留幾秒鐘,自動進入應用程序的主界面。

  首先先定義WelcomeActivity布局,布局非常簡單的,就一張圖片,代碼如下所示:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:layout_width="match_parent"android:layout_height="match_parent"android:orientation="vertical"android:gravity="center"><ImageViewandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:src="@mipmap/logo"/></LinearLayout>

  啟動界面時,兩秒跳轉到另一個界面,代碼如下所示:

package com.nyl.shoppingmall.app.activity;import android.app.Activity;
import android.content.Intent;
import android.os.Handler;
import android.os.Bundle;import com.nyl.shoppingmall.R;/*** 歡迎界面*/
public class WelcomeActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.activity_welcome);//兩秒鐘進入MainActivitynew Handler().postDelayed(new Runnable() {@Overridepublic void run() {//啟動MainActivity主頁面,這段代碼是在主線程執行startActivity(new Intent(WelcomeActivity.this,MainActivity.class));//關閉當前頁面(結束WelcomeActivity)
                finish();}},2000);}
}

  啟動頁面效果圖如下:

  

  兩秒鐘后跳轉到主界面,效果圖如下:

  

  這里一個非常簡單的啟動頁面,就學到這里咯!

轉載于:https://www.cnblogs.com/nylcy/p/6588776.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/393435.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/393435.shtml
英文地址,請注明出處:http://en.pswp.cn/news/393435.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

DELL安裝不了mysql_Windows 版本 Mysql 8.x 安裝

1、官網下載安裝包百度網盤鏈接&#xff1a;https://pan.baidu.com/s/1cFRbQM5720xrzMxbgjPeyA提取碼&#xff1a;xlz72、解壓安裝包并新建一個文件夾作為安裝目錄(mysqlInstall)3、配置 Mysql 環境變量4、在解壓好的目錄下新建一個 my.ini 文件(注意&#xff1a;my.ini 文件和…

lambda 使用_如何使用Lambda和API網關構建API

lambda 使用Do you want to access your database, control your system, or execute some code from another website? An API can do all of this for you, and they’re surprisingly easy to set up.您是否要訪問數據庫&#xff0c;控制系統或從其他網站執行一些代碼&…

Hyper-V Server聯機調整虛擬硬盤大小

1. 技術概述&#xff1a; 從 Windows Server 2012 R2開始&#xff0c;管理員可以在運行虛擬機的同時&#xff0c;使用 Hyper-V 來擴展或壓縮虛擬硬盤的大小。存儲管理員可以通過對運行中的虛擬硬盤執行維護操作來避免代價不菲的停機。不再需要關閉虛擬機&#xff0c;這可以避免…

leetcode162. 尋找峰值(二分法)

峰值元素是指其值大于左右相鄰值的元素。 給定一個輸入數組 nums&#xff0c;其中 nums[i] ≠ nums[i1]&#xff0c;找到峰值元素并返回其索引。 數組可能包含多個峰值&#xff0c;在這種情況下&#xff0c;返回任何一個峰值所在位置即可。 你可以假設 nums[-1] nums[n] -…

python網絡爬蟲(5)BeautifulSoup的使用示范

創建并顯示原始內容 其中的lxml第三方解釋器加快解析速度 import bs4 from bs4 import BeautifulSoup html_str """ <html><head><title>The Dormouses story</title></head> <body> <p class"title"><…

Mingw編譯DLib

Mingw編譯DLib 因為機器上安裝了qt-opensource-windows-x86-mingw530-5.8.0&#xff0c;所以準備使用其自帶的mingw530來編譯DLib使用。 因為DLib使用CMake的構建腳本&#xff0c;所以還請先安裝好CMake。 cmake的下載地址如下https://cmake.org/files/v3.7/cmake-3.7.2-win64-…

探索JavaScript的關閉功能

Discover Functional JavaScript was named one of the best new Functional Programming books by BookAuthority!“發現功能JavaScript”被BookAuthority評為最佳新功能編程書籍之一 &#xff01; A closure is an inner function that has access to the outer scope, even…

QueryList 配置curl參數 的文檔位置 QueryList抓取https 終于找到了

需要設置ssl證書&#xff0c;或者不驗證證書&#xff0c;例&#xff1a;$ql QueryList::get(https://...,[],[verify > false]);設置這個 verify > false , 所以curl的其他參數就在這里配置即可 文檔在 https://guzzle-cn.readthedocs.io/zh_CN/latest/request-optio…

leetcode981. 基于時間的鍵值存儲(treemap)

創建一個基于時間的鍵值存儲類 TimeMap&#xff0c;它支持下面兩個操作&#xff1a; set(string key, string value, int timestamp) 存儲鍵 key、值 value&#xff0c;以及給定的時間戳 timestamp。 2. get(string key, int timestamp) 返回先前調用 set(key, value, times…

物聯網筆記

轉載于:https://www.cnblogs.com/16-C-kai/p/6596682.html

關于大學生玩網絡游戲的調查問卷

1.創建問卷&#xff0c;輸入調查名稱 2編輯問卷 3檢查問卷&#xff0c;是否有誤 4.提交并發布問卷 5分享問卷 6.問卷分析 轉載于:https://www.cnblogs.com/dzw1996/p/7786754.html

java自動排序_java ArrayList自動排序算法的實現

前幾天寫的那個是錯誤的&#xff0c;在這里將正確的更新。。。通過實現ComParator接口&#xff0c;并且對Compare函數進行重寫&#xff0c;自定義排序規則實現對ArrayList中對象的排序。。Student類定義&#xff1a;通過右鍵-》source-》自動生成Set和get方法package first;imp…

1到100的二進制編碼_每天經過100天的編碼后,我學到了什么

1到100的二進制編碼Eleftheria Batsou is a web developer from Thessaloniki, Greece. She gave a talk at the Codegarden conference about her experience doing a solid 100 days of coding every day as part of the #100DaysOfCode Challenge.Eleftheria Batsou是來自希…

第六次 實驗

轉載于:https://www.cnblogs.com/P201821440005/p/10967987.html

leetcode658. 找到 K 個最接近的元素(二分法)

給定一個排序好的數組&#xff0c;兩個整數 k 和 x&#xff0c;從數組中找到最靠近 x&#xff08;兩數之差最小&#xff09;的 k 個數。返回的結果必須要是按升序排好的。如果有兩個數與 x 的差值一樣&#xff0c;優先選擇數值較小的那個數。 示例 1: 輸入: [1,2,3,4,5], k4,…

du命令、df命令用法

一、du命令 [plain] view plaincopy print?[rootwc1 mysql]# du --help Usage: du [OPTION]... [FILE]... or: du [OPTION]... --files0-fromF Summarize disk usage of each FILE, recursively for directories. Mandatory arguments to long options are mandatory…

mysql 循環創建列_mysql – 查詢列中的循環值

我需要創建一個查詢,一次只將一列的值移動一行↑&#xff1a;----------------------------| anotherCOL | values_to_loop |----------------------------| 1 | 1 || 2 | 2 || 3 | 3 || 4 | 4 || 5 | 5 || 6 | 6 || 7 | 7 || 8 | 8 || 9 | 9 || 10 | 10 |--------------------…

因子個數與因子和

題目&#xff1a;LightOJ:1341 - Aladdin and the Flying Carpet(因子個數&#xff09; Its said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first mystery. Aladdin was …

如何在JavaScript中直觀地設計狀態

by Shawn McKay肖恩麥凱(Shawn McKay) 如何在JavaScript中直觀地設計狀態 (How to visually design state in JavaScript) 使用狀態機和狀態圖開發應用程序的路線圖 (A roadmap for developing applications with state machines & statecharts) Why does state managemen…

SQL Server 2008 - Cannot set a credential for principal 'sa'.

很久沒有用到SQL Server了&#xff0c;今天有幸在幫同事解決一個SQL Server數據連接的問題時突然發現我無法修改我的sa用戶的密碼了。過程是這樣的&#xff1a;一開始我本地的數據庫實例是Windows認證方式&#xff0c;我想將它改成Windows和數據庫混合認證方式后用sa賬戶登錄&a…