最近,我已更新到Android Studio 3.5。我有三个视图:名为sample.xml文件的垂直LinearLayout(ViewGroup)中的EditText,TextView和Button。当我按ctrl + alt + L格式化内容时,所有视图都会自动重新排列。在我的情况下,位于底部的Button视图在格式化后已到达顶部,位于第一和第二顶部的EditText和TextView也分别在垂直LinearLayout中分别排在第二和第三位置。
Android Studio:3.5
Android Gradle插件:3.5.0
摇篮:5.4.1
JRE:1.8.0_202-release-1483-b03x64
作业系统:Windows 8.1(amd64)v6.3
当我运行应用程序时,SplashScreen 在屏幕上闪烁几分之一秒,然后完全消失 3 秒。完成 3 秒后 MainActivity 启动。问题是如何显示我的启动屏幕而不消失?
public class SplashScreen extends Activity {
private static int SPLASH_TIME_OUT = 3000;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash_screen);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
startActivity(new Intent(SplashScreen.this, MainActivity.class));
}
}, SPLASH_TIME_OUT);
SplashScreen.this.finish();
}
@Override
public void onBackPressed() {
SplashScreen.this.finish();
super.onBackPressed();
}}
Run Code Online (Sandbox Code Playgroud)
清单文件
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity android:name="com.simbotix.guardianonthego.SplashScreen" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.simbotix.guardianonthego.MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" /> …Run Code Online (Sandbox Code Playgroud)