闪屏的应用程序和隐藏操作栏 [英] splash screen application and hide action bar

查看:117
本文介绍了闪屏的应用程序和隐藏操作栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想弄清楚怎么可能隐藏了一个闪屏的活动操作栏。 我做了一些东西,隐藏我的行动吧我闪屏,但有一个问题: 我的启动画面出现之前,有喜欢与谁短暂出现的操作栏中选择一个活动......,我不知道如何隐藏它!

我的开机画面,只有当我们接触的第一次类似的介绍应用程序的应用程序出现。

code:

 包com.example.basicmaponline;

进口android.app.Activity;
进口android.content.Intent;
进口android.os.Bundle;
进口android.view.Window;

公共类简介延伸活动{

@覆盖
保护无效的onCreate(包savedInstanceState){
    // TODO自动生成方法存根
    super.onCreate(savedInstanceState);


    。getWindow()requestFeature(Window.FEATURE_ACTION_BAR);
    getActionBar()隐藏()。

    的setContentView(R.layout.intro);

    螺纹定时器=新的Thread(){
        公共无效的run(){
            尝试{
                睡眠(3000);
            }赶上(InterruptedException异常E){
                e.printStackTrace();
            }最后{
                意图openMenu =新的意向书(com.example.basicmaponline.MENU);
                startActivity(openMenu);
            }
        }
    };
    timer.start();
}

@覆盖
保护无效的onPause(){
    // TODO自动生成方法存根
    super.onPause();
    完();
}

}
 

清单:

 < XML版本=1.0编码=UTF-8&GT?;
<舱单的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
包=com.example.basicmaponline
安卓版code =1
机器人:VERSIONNAME =1.0>

<用途-SDK
    安卓的minSdkVersion =11
    机器人:targetSdkVersion =17/>
<使用-权限的Andr​​oid:名称=android.permission.CALL_PHONE>< /使用-许可>
<使用-权限的Andr​​oid:名称=android.permission.WRITE_EXTERNAL_STORAG​​E/>
<使用-权限的Andr​​oid:名称=android.permission.INTERNET对/>
<使用-权限的Andr​​oid:名称=android.permission.ACCESS_WIFI_STATE/>
<使用-权限的Andr​​oid:名称=android.permission.ACCESS_NETWORK_STATE/>
<使用-权限的Andr​​oid:名称=android.permission.ACCESS_FINE_LOCATION/>
<使用-权限的Andr​​oid:名称=android.permission.ACCESS_COARSE_LOCATION/>
<使用-权限的Andr​​oid:名称=android.permission.ACCESS_GPS>< /使用-许可>

<应用
    机器人:allowBackup =真
    机器人:图标=@可绘制/ lojacidadao
    机器人:标签=@字符串/ APP_NAME
     机器人:主题=@风格/ AppTheme>
    <活动
        机器人:名称=com.example.basicmaponline.Intro
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ APP_NAME>
        <意向滤光器>
            <作用机器人:名称=android.intent.action.MAIN/>

            <类机器人:名称=android.intent.category.LAUNCHER/>
        &所述; /意图滤光器>
    < /活性GT;

    <活动
        机器人:名称=com.example.basicmaponline.Menu
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ APP_NAME>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.MENU/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;

    <活动
        机器人:名称=com.example.basicmaponline.Mapa
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ MAP_NAME>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.MAPA/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;
    <活动
        机器人:名称=com.example.basicmaponline.Lojas
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ lojas_name>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.LOJAS/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;

    <活动
        机器人:名称=com.example.basicmaponline.InfoLoja
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ loja_name>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.INFOLOJA/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;

    <活动
        机器人:名称=com.example.basicmaponline.Balcoes
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ balcoes_name>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.BALCOES/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;

    <活动
        机器人:名称=com.example.basicmaponline.Entidade
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ balcao_name>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.ENTIDADE/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;

     <活动
        机器人:名称=com.example.basicmaponline.Servicos
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ servicos_name>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.SERVICOS/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;

     <活动
        机器人:名称=com.example.basicmaponline.InfoServico
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ servico_name>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.INFOSERVICO/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;

     <活动
        机器人:名称=com.example.basicmaponline.Pesquisar
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ pesquisa_name>
        <意向滤光器>
            <作用机器人:名称=com.example.basicmaponline.PESQUISAR/>

            <类机器人:名称=android.intent.category.DEFAULT/>
        &所述; /意图滤光器>
    < /活性GT;

< /用途>
< /舱单>
 

解决方案

为什么不添加到第一个活动的表现主题,以排除操作栏,甚至可能通知栏?

是这样的:

 <应用
    机器人:allowBackup =真
    机器人:图标=@可绘制/ lojacidadao
    机器人:标签=@字符串/ APP_NAME
     机器人:主题=@风格/ AppTheme>
    <活动
        机器人:名称=com.example.basicmaponline.Intro
        机器人:screenOrientation =画像
        机器人:标签=@字符串/ APP_NAME
        机器人:主题=@安卓风格/ Theme.NoTitleBar.Fullscreen>
        <意向滤光器>
            <作用机器人:名称=android.intent.action.MAIN/>

            <类机器人:名称=android.intent.category.LAUNCHER/>
        &所述; /意图滤光器>
    < /活性GT;
 ...
 

BTW,原因你有行动起来吧,因为你已经设置的默认主题拥有它,在应用程序标签,所以它不是一个活动之前,你的,它真的是你自己的开机活动​​。

I'm trying to figure out how is it possible to hide the action bar for a splash screen activity. I did something which hide my action bar on my splash screen, but there is one problem: before my splash screen appears, there is like an activity with an action bar who appears briefly... and I don't know how to hide it!

My splash screen only appears when we touch the application for the first time like an introduction of the application.

Code :

package com.example.basicmaponline;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Window;

public class Intro extends Activity{

@Override
protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);


    getWindow().requestFeature(Window.FEATURE_ACTION_BAR);
    getActionBar().hide();

    setContentView(R.layout.intro);

    Thread timer = new Thread(){
        public void run(){
            try{
                sleep(3000);
            }catch (InterruptedException e) {
                e.printStackTrace();
            }finally{
                Intent openMenu = new Intent("com.example.basicmaponline.MENU");
                startActivity(openMenu);
            }
        }
    };
    timer.start();
}

@Override
protected void onPause() {
    // TODO Auto-generated method stub
    super.onPause();
    finish();
}

}

Manifest :

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

<uses-sdk
    android:minSdkVersion="11"
    android:targetSdkVersion="17" />
<uses-permission android:name="android.permission.CALL_PHONE"></uses-permission>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_GPS"></uses-permission>

<application
    android:allowBackup="true"
    android:icon="@drawable/lojacidadao"
    android:label="@string/app_name"
     android:theme="@style/AppTheme">
    <activity
        android:name="com.example.basicmaponline.Intro"
        android:screenOrientation="portrait"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

    <activity
        android:name="com.example.basicmaponline.Menu"
        android:screenOrientation="portrait"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="com.example.basicmaponline.MENU" />

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

    <activity
        android:name="com.example.basicmaponline.Mapa"
        android:screenOrientation="portrait"
        android:label="@string/map_name">
        <intent-filter>
            <action android:name="com.example.basicmaponline.MAPA" />

            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>
    </activity>
    <activity
        android:name="com.example.basicmaponline.Lojas"
        android:screenOrientation="portrait"
        android:label="@string/lojas_name">
        <intent-filter>
            <action android:name="com.example.basicmaponline.LOJAS" />

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

    <activity
        android:name="com.example.basicmaponline.InfoLoja"
        android:screenOrientation="portrait"
        android:label="@string/loja_name">
        <intent-filter>
            <action android:name="com.example.basicmaponline.INFOLOJA" />

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

    <activity
        android:name="com.example.basicmaponline.Balcoes"
        android:screenOrientation="portrait"
        android:label="@string/balcoes_name" >
        <intent-filter>
            <action android:name="com.example.basicmaponline.BALCOES" />

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

    <activity
        android:name="com.example.basicmaponline.Entidade"
        android:screenOrientation="portrait"
        android:label="@string/balcao_name">
        <intent-filter>
            <action android:name="com.example.basicmaponline.ENTIDADE" />

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

     <activity
        android:name="com.example.basicmaponline.Servicos"
        android:screenOrientation="portrait"
        android:label="@string/servicos_name">
        <intent-filter>
            <action android:name="com.example.basicmaponline.SERVICOS" />

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

     <activity
        android:name="com.example.basicmaponline.InfoServico"
        android:screenOrientation="portrait"
        android:label="@string/servico_name">
        <intent-filter>
            <action android:name="com.example.basicmaponline.INFOSERVICO" />

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

     <activity
        android:name="com.example.basicmaponline.Pesquisar"
        android:screenOrientation="portrait"
        android:label="@string/pesquisa_name" >
        <intent-filter>
            <action android:name="com.example.basicmaponline.PESQUISAR" />

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

</application>
</manifest>

解决方案

why not add to the manifest the theme of the first activity to exclude the action bar, and maybe even the notification bar?

something like:

<application
    android:allowBackup="true"
    android:icon="@drawable/lojacidadao"
    android:label="@string/app_name"
     android:theme="@style/AppTheme">
    <activity
        android:name="com.example.basicmaponline.Intro"
        android:screenOrientation="portrait"
        android:label="@string/app_name" 
        android:theme="@android:style/Theme.NoTitleBar.Fullscreen">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

BTW, the reason you have the action bar is because you have set the default theme to have it, in the application tag, so it's not an activity before yours, it's really your own splash activity.

这篇关于闪屏的应用程序和隐藏操作栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆