日日操夜夜添-日日操影院-日日草夜夜操-日日干干-精品一区二区三区波多野结衣-精品一区二区三区高清免费不卡

公告:魔扣目錄網(wǎng)為廣大站長(zhǎng)提供免費(fèi)收錄網(wǎng)站服務(wù),提交前請(qǐng)做好本站友鏈:【 網(wǎng)站目錄:http://www.ylptlb.cn 】, 免友鏈快審服務(wù)(50元/站),

點(diǎn)擊這里在線咨詢(xún)客服
新站提交
  • 網(wǎng)站:51998
  • 待審:31
  • 小程序:12
  • 文章:1030137
  • 會(huì)員:747

本文介紹了如何在Android中顯示閃屏?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!

問(wèn)題描述

我想在應(yīng)用程序加載時(shí)顯示閃屏,這是我的Java代碼:

ImageView splash = (ImageView) this.findViewById(R.id.splashscreen);

splash.postDelayed(new Runnable(){
    splash.setVisibility(View.GONE);
}, 3000);

但我在postDelayed()調(diào)用中收到錯(cuò)誤“無(wú)法解析符號(hào)”。我還收到了“意外令牌”

}, 3000);

最后,這是我的布局:

<TextView
    android:text="@string/hello_world"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<ImageView
    android:id="@+id/splashscreen"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:src="@drawable/splash"
    android:layout_gravity="center"/> 

日志:

9:41:01 PM Throwable
       Read access is allowed from event dispatch thread or inside read-action only (see com.intellij.openapi.application.Application.runReadAction())
       Details: Current thread: Thread[ApplicationImpl pooled thread 239,4,main] 359404630
       Our dispatch thread:Thread[AWT-EventQueue-0 0.4.2#AI-133.970939, eap:true,6,main] 1198871553
       SystemEventQueueThread: Thread[AWT-EventQueue-0 0.4.2#AI-133.970939, eap:true,6,main] 1198871553

9:41:13 PM編譯在12秒內(nèi)成功完成

清單文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.conversation" >

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name="com.example.conversation.splash"
        android:configChanges="orientation|keyboardHidden|screenSize"
        android:theme="@android:style/Theme.NoTitleBar" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

推薦答案

您可以執(zhí)行以下操作:

private static final int SPLASH_TIME_OUT = 2000;
private static final Handler mHandler = new Handler();

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);

    mHandler.postDelayed(new Runnable() {

        @Override
        public void run() {

                startActivity(new Intent(getApplicationContext(), YourActivity.class)); 
                finish();   
        }
    }, SPLASH_TIME_OUT);    
}

此處activity_splash.xml是您的splash活動(dòng)布局,YourActivity是您要轉(zhuǎn)到的活動(dòng)

這篇關(guān)于如何在Android中顯示閃屏?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,

分享到:
標(biāo)簽:Android 如何在 顯示
用戶無(wú)頭像

網(wǎng)友整理

注冊(cè)時(shí)間:

網(wǎng)站:5 個(gè)   小程序:0 個(gè)  文章:12 篇

  • 51998

    網(wǎng)站

  • 12

    小程序

  • 1030137

    文章

  • 747

    會(huì)員

趕快注冊(cè)賬號(hào),推廣您的網(wǎng)站吧!
最新入駐小程序

數(shù)獨(dú)大挑戰(zhàn)2018-06-03

數(shù)獨(dú)一種數(shù)學(xué)游戲,玩家需要根據(jù)9

答題星2018-06-03

您可以通過(guò)答題星輕松地創(chuàng)建試卷

全階人生考試2018-06-03

各種考試題,題庫(kù),初中,高中,大學(xué)四六

運(yùn)動(dòng)步數(shù)有氧達(dá)人2018-06-03

記錄運(yùn)動(dòng)步數(shù),積累氧氣值。還可偷

每日養(yǎng)生app2018-06-03

每日養(yǎng)生,天天健康

體育訓(xùn)練成績(jī)?cè)u(píng)定2018-06-03

通用課目體育訓(xùn)練成績(jī)?cè)u(píng)定