我有三个图像与我,我希望他们出现在第一个布局xml像飞溅视图,以便他们只能被查看一次,即该活动将被称为只有一次当应用程序获取的安装,或者应用程序获取一个新的更新,否则应用程序应该总是从第二个活动开始,我不知道我应该如何开始使用此:Android设置启动画面(活动)像Iphone Part1
任何一个可以告诉我任何想法如何这可以做到。
仅显示一次飞溅。这个问题的
接着的部分是here
编码将不胜感激。
我有三个图像与我,我希望他们出现在第一个布局xml像飞溅视图,以便他们只能被查看一次,即该活动将被称为只有一次当应用程序获取的安装,或者应用程序获取一个新的更新,否则应用程序应该总是从第二个活动开始,我不知道我应该如何开始使用此:Android设置启动画面(活动)像Iphone Part1
任何一个可以告诉我任何想法如何这可以做到。
仅显示一次飞溅。这个问题的
接着的部分是here
编码将不胜感激。
保存在预置一个标志,当你启动应用程序,你已经做了之后欢迎屏幕的东西。在显示欢迎屏幕之前检查此标志。如果标志存在(换句话说,如果不是第一次),不要显示它。
In your activity:
SharedPreferences mPrefs;
final String welcomeScreenShownPref = "welcomeScreenShown";
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
// second argument is the default to use if the preference can't be found
Boolean welcomeScreenShown = mPrefs.getBoolean(welcomeScreenShownPref, false);
if (!welcomeScreenShown) {
// here you can launch another activity if you like
// the code below will display a popup
String whatsNewTitle = getResources().getString(R.string.whatsNewTitle);
String whatsNewText = getResources().getString(R.string.whatsNewText);
new AlertDialog.Builder(this).setIcon(android.R.drawable.ic_dialog_alert).setTitle(whatsNewTitle).setMessage(whatsNewText).setPositiveButton(
R.string.ok, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).show();
SharedPreferences.Editor editor = mPrefs.edit();
editor.putBoolean(welcomeScreenShownPref, true);
editor.commit(); // Very important to save the preference
}
}
Thx dude这将解决我的第二个问题,即只显示一次飞溅......关于第一个问题的任何想法(使滚动视图闪烁表单并在滚动完成时切换到第二个活动) – iOSBee 2013-04-23 07:45:20
试试这个:
public class MainActivity extends Activity {
private Thread mSplashThread;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
try {
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.splash);
final MainActivity sPlashScreen = this;
mSplashThread = new Thread() {
@Override
public void run() {
try {
synchronized (this) {
wait(4000);
}
} catch (InterruptedException ex) {
}
finish();
Intent intent = new Intent();
intent.setClass(sPlashScreen, StartNewActivity.class);// <-- Activity you want to start after Splash
startActivity(intent);
}
};
mSplashThread.start();
} catch (Exception e) {
}
}
@Override
public boolean onTouchEvent(MotionEvent evt) {
try {
if (evt.getAction() == MotionEvent.ACTION_DOWN) {
synchronized (mSplashThread) {
mSplashThread.notifyAll();
}
}
} catch (Exception e) {
}
return true;
}
}
你把图像中的splash.xml
显示
老兄我想要它手动定时器将自动更改图像后特定时间,我想滚动视图或任何其他方式,我可以处理这个概率... – iOSBee 2013-04-23 07:37:03
你有什么问题的活动?在第一次运行中显示飞溅?或两个创建启动画面? – stinepike 2013-04-23 07:27:10
他们都是:( – iOSBee 2013-04-23 07:29:42
初始屏幕是Android上的反模式,你可能要考虑在初始化应用程序时不要显示初始屏幕 – keyboardsurfer 2013-04-23 07:33:21