我有一个启动图像,我想在应用程序启动时显示.我将它用作启动图像 - 我希望它在程序启动之前显示(将图片重命名为Default.png).在Apple的HIG中,他们说应该"避免"使用启动画面作为启动图像.
我知道不建议用户经常不喜欢它们,但它会让Apple拒绝我的申请吗?如果是这样,我如何显示启动画面,以便在应用程序启动后立即显示,但不会违反这些规则?因为我看过使用启动画面的应用程序作为启动图像.
Thx提前!
我有一些spash屏幕的麻烦.当我启动应用程序时,启动屏幕活动会启动几秒钟.主要活动启动后.
如果我按下主活动上的主页按钮然后从应用程序列表重新启动应用程序,则尽管应用程序已经在后台,但启动活动仍会再次启动.但我希望主要活动从记忆中恢复.
如果我按下后退按钮,那么android会将我返回到主活动的上一个副本.
制作启动画面只需要出现一次我需要做什么?如何在点击主页按钮之前从我看到的最后一个屏幕重新启动我的应用程序?
<activity
android:name=".ui.SplashActivity"
android:noHistory="true"
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=".ui.MainActivity"/>
Run Code Online (Sandbox Code Playgroud) 我知道如何通过surfaceView这样做,我想知道我是否应该顺其自然.
我只是想创建一个闪屏,它有一个全屏图像,顶部有一个不透明的图像(经过短暂的延迟).我无法弄清楚如何在XML代码中完成此操作.
这就是我的......
<?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
android:id="@+id/lightDot"
android:src="@drawable/splashlight"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@null"
/>
<ImageView
android:id="@+id/bGround"
android:src="@drawable/splash"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
/>
Run Code Online (Sandbox Code Playgroud)
所以我的'lightDot'对象是半透明的,我希望在短暂延迟后将其覆盖在我的bGround资源之上.
这是我的代码:
import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ImageView;
public class SplashAct extends Activity implements OnClickListener{
Button mainButton;
Button lightDot;
ImageView background;
ImageView light;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
background = (ImageView)findViewById(R.id.bGround);
light = (ImageView)findViewById(R.id.lightDot);
background.setOnClickListener(this);
}
@Override
public …Run Code Online (Sandbox Code Playgroud) 我已经为我的android应用创建了初始屏幕。我的问题很简单。5秒钟后,启动屏幕消失,主要活动起作用。然后,如果我单击“返回”按钮,它将再次返回启动屏幕。但我不要这个。
如果用户在mainactivity上触摸“返回”按钮,则应用必须进入没有闪屏的android菜单。我该如何解决?
package com.example.androidfirst;
import android.app.Activity;
public class SplashActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
Thread timer = new Thread() { //new Thread
@Override
public void run() {
try {
sleep(5000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
finally {
Intent MainAct = new Intent("com.example.androidfirst.MAINACTIVITY");
startActivity(MainAct);
try {
this.finalize();
}
catch (Throwable e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
};
timer.start();
}
}
Run Code Online (Sandbox Code Playgroud) 如何在安装后第一次启动应用程序时添加仅显示的启动画面. 像是如何使用指南.
我还在探索xCode/Objective-C,我想知道如何能够改变UIImage的alpha.我尝试编写自己的代码,但是在UIImage类型的对象上找不到错误'Property'alpha'.如果我注释掉alpha变化线,则启动画面会起作用.我的代码如下.
//
// ViewController.m
#import "ViewController.h"
@interface ViewController ()
@property (nonatomic,weak) IBOutlet UIImage *logo;
@end
@implementation ViewController
ADBannerView *_bannerView;
- (void)viewDidLoad
{
[super viewDidLoad];
[self.view addSubview:_bannerView];
[NSTimer scheduledTimerWithTimeInterval:2.0 target:self selector:@selector(showLogo:) userInfo:nil repeats:NO];
}
- (void)showLogo:(NSTimer *) timer{
[UIView animateWithDuration:2.0 animations:^{
self.logo.alpha = 1.0;
} completion:^(BOOL finished){
[UIView animateWithDuration:2.0 animations:^{
self.logo.alpha = 0.0;
} completion:^(BOOL finished){
ViewController *controller = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"];
[self.navigationController pushViewController:controller animated:YES];
}];
}];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated. …Run Code Online (Sandbox Code Playgroud) 我在onCreate中启动了一个警告对话框,允许用户从两个不同的活动中进行选择.我使用了具有正值和负值的警告对话框但不幸的是我收到了错误.是否无法使用此类警报对话框来运行两种不同的活动?如果是的话怎么可能?我遇到这种错误:
[Android Application]
[Android Application]
[Android Application]
[Android Application]
[Android Application]
[Android Application]
[Android Application]
[Android Application]
DalvikVM [localhost:8602]
Thread [<1> main] (Running)
Thread [<10> Binder_2] (Running)
Thread [<9> Binder_1] (Running)
Thread [<11> Thread-198] (Suspended (exception RuntimeException))
<VM does not provide monitor information>
Handler.<init>(Handler$Callback, boolean) line: 200
Handler.<init>() line: 114
AlertDialog(Dialog).<init>(Context, int, boolean) line: 109
AlertDialog.<init>(Context, int, boolean) line: 114
AlertDialog$Builder.create() line: 931
MainActivity$splashscreen.run() line: 68
[Android Application]
Run Code Online (Sandbox Code Playgroud)
这是我的警告对话框的代码
public class MainActivity extends Activity {
//ImageView image;
@Override
protected void …Run Code Online (Sandbox Code Playgroud) public MainWindow()
{
Thread.Sleep(4000);
InitializeComponent();
}
Run Code Online (Sandbox Code Playgroud)
在我的主窗口中,我将Thread.Sleep其设置为4秒钟以创建4秒延迟,然后我的应用程序可以运行其余代码.从本质上讲,我这样做是为了让我的Splash Screen保证显示4秒,而不是应用程序花费多长时间(到目前为止不到一秒).我只是在愚弄时试图这样做,所以我只是想知道这种方法是否有任何缺点.
我问,因为有很多问题要求人们如何让他们的Splash Screens显示更长时间.是否有一个特殊的原因我不应该这样做或为什么其他人没有尝试过这个?
而不是通过项目选项使用png图像为splashscreen我想使用我自己的表格用于启动画面.
我在以下链接中找到了XE2的解决方案,但它对Delphi 10 Seattle不起作用:https://stackoverflow.com/a/9080804/2728408
下面我有一些我在项目中尝试过的例子.dpr:
例1:
program Project2;
uses
FMX.Forms,
System.SysUtils,
Unit1 in 'Unit1.pas' {MainForm},
Unit2 in 'Unit2.pas' {SplashForm};
{$R *.res}
begin
Application.Initialize;
SplashForm := TSplashForm.Create(nil);
SplashForm.Show;
Application.ProcessMessages;
Sleep(1000); // Whatever to control display time of splash screen
Application.CreateForm(TMainForm, MainForm);
SplashForm.Close;
SplashForm.Free;
Application.Run;
end.
Run Code Online (Sandbox Code Playgroud)
例2:
program Project2;
uses
FMX.Forms,
System.SysUtils,
Unit1 in 'Unit1.pas' {MainForm},
Unit2 in 'Unit2.pas' {SplashForm};
{$R *.res}
begin
Application.Initialize;
Application.CreateForm(TSplashForm, SplashForm);
Application.Run;
Sleep(1000);
Application.Terminate;// Also tried Application.Destroy
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
Run Code Online (Sandbox Code Playgroud)
例3:
program …Run Code Online (Sandbox Code Playgroud) 我在创造一个游戏.
目前,对于我的启动画面,我使用的是图像.
问题是它延伸.
陶氏我会阻止吗?
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="hitesh.asimplegame.SplashScrean"
android:background="@drawable/mulalo">
Run Code Online (Sandbox Code Playgroud) splash-screen ×10
android ×6
ios ×2
delphi ×1
firemonkey ×1
install ×1
iphone ×1
mobile ×1
objective-c ×1
uiimage ×1
wpf ×1
xcode ×1
xml ×1