这是什么装载般的菜单吗? [英] What is this loading-like menu?

查看:122
本文介绍了这是什么装载般的菜单吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在编程Android和拥有Facebook登录 - 只要我的应用程序启动或登录到Facebook的它抛出了这个画面:

我已经无法正确命名该屏幕也没有我能找到它在谷歌。

我希望更改其设计 - 主要更改操作杆为我的应用程序动作条不具备徽标和应用程序名称

有谁知道这是什么屏幕被调用,在那里我可以找到它的文档?

我不知道,如果它的相关性,但纺纱装圆仅present时,该屏幕通过Facebook登录显示 - 屏幕还显示,如果你启动应用程序多达生效后停止它,但没有圈


解决方案

这加载屏幕被称为闪屏。
是如何改变的好你的计算器启动画面(如下重要/关键/所需的步骤)。这也将删除闪屏操作栏以及

链接的关键部分:


  

添加闪屏图片


  
  

首先你需要一个闪屏图像。由于Android设备进来
  各项决议,可能要出货几个闪屏作为
  在谷歌的最佳实践支持多种屏幕描述。
  为简单起见,我们只船一个在这里是480×800。这应该
  支持大多数的手机尺寸pretty好,而Android将规模作为
  最好就可以了。


  
  

添加你想要的图片/ GIF到资源\\可绘制


  
  

您需要在您的layout.xml文件中定义spash屏幕


 <?XML版本=1.0编码=UTF-8&GT?;
  < LinearLayout中的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android
          机器人:方向=垂直的android:layout_width =FILL_PARENT
          机器人:layout_height =FILL_PARENT>          < ImageView的ID =@ + ID /闪屏的android:layout_width =WRAP_CONTENT
                  机器人:layout_height =FILL_PARENT
                  机器人:SRC =@绘制/扑通
                  机器人:layout_gravity =中心/>          <的TextView的android:layout_width =FILL_PARENT< - 不needed-> - >
                    机器人:layout_height =WRAP_CONTENT
                    机器人:文字=世界您好,扑通/> <! - 没有必要 - >  < / LinearLayout中>


  

和您的活动:


 进口android.app.Activity;
进口android.content.Intent;
进口android.os.Bundle;
进口android.os.Handler;公共类飞溅延伸活动{    / **等待时间** /
    私人最终诠释SPLASH_DISPLAY_LENGTH = 1000;    / **当第一次创建活动调用。 * /
    @覆盖
    公共无效的onCreate(捆绑冰柱){
        super.onCreate(冰柱);
        的setContentView(R.layout.splashscreen);        / *新的处理程序,开始菜单 - 活动
         几秒钟后*,并关闭启动画面。* /
        新的处理程序()。postDelayed(新的Runnable(){
            @覆盖
            公共无效的run(){
                / *创建一个Intent,将开始菜单 - 活动。 * /
                意图mainIntent =新意图(Splash.this,Menu.class);
                Splash.this.startActivity(mainIntent);
                Splash.this.finish();
            }
        },SPLASH_DISPLAY_LENGTH);
    }
}

I've been programming with Android and have a Facebook login - Whenever my app starts up or is logging into Facebook it throws up this screen:

I've been unable to correctly name this screen nor have I been able to find it on Google.

I'm wishing to make changes to its design - Primarily change the action-bar as my apps actionbar doesn't have the logo nor the app name.

Does anyone know what this screen is called, and where I can find documentation on it?

I don't know if its relevant, but the spinning loading circle is only present when this screen shows via the Facebook login - The screen also shows if you start the app up after force stopping it but without the circle.

解决方案

This "loading screen" is called a splash screen. This is a good stackoverflow on how to change your splash screen (important/key/needed steps listed below). It will also remove the action bar in the splash screen as well.

Key parts of link:

Add Splash Screen Image

First you need a splash screen image. Because Android devices come in various resolutions, you may want to ship several splash screens as described in Google's Best Practices for Supporting Multiple Screens. For simplicity, we'll just ship one here that is 480x800. It should support most phone sizes pretty well, and Android will scale it as best it can.

Add the the image/gif you want into your Resources\Drawable

You need to define the spash screen in your layout.xml file

<?xml version="1.0" encoding="utf-8"?>
  <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical" android:layout_width="fill_parent"
          android:layout_height="fill_parent">

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

          <TextView android:layout_width="fill_parent"  <!-- Not needed->-->
                    android:layout_height="wrap_content"
                    android:text="Hello World, splash"/> <!--Not Needed -->

  </LinearLayout>

And your activity:

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;

public class Splash extends Activity {

    /** Duration of wait **/
    private final int SPLASH_DISPLAY_LENGTH = 1000;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        setContentView(R.layout.splashscreen);

        /* New Handler to start the Menu-Activity 
         * and close this Splash-Screen after some seconds.*/
        new Handler().postDelayed(new Runnable(){
            @Override
            public void run() {
                /* Create an Intent that will start the Menu-Activity. */
                Intent mainIntent = new Intent(Splash.this,Menu.class);
                Splash.this.startActivity(mainIntent);
                Splash.this.finish();
            }
        }, SPLASH_DISPLAY_LENGTH);
    }
}

这篇关于这是什么装载般的菜单吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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