Код для splash.xml:Начальный экран не отображается правильно
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
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"
android:background="@drawable/notice2"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context=".SplashScreen">
</RelativeLayout>
Код для AndroidManifest.xml:
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity
android:name="com.kksworld.noticeboard.SplashScreen"
android:label="@string/title_activity_splash_screen"
android:theme="@style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.kksworld.noticeboard.LoginActivity"
android:label="@string/app_name"
android:theme="@style/AppTheme.NoActionBar">
</activity>
<activity
android:name="com.kksworld.noticeboard.Registration"
android:label="@string/title_activity_registration"
android:theme="@style/AppTheme.NoActionBar" />
</application>
`Я пытаюсь добавить заставку в моем проекте. Но после запуска приложения экран останавливается на время, когда я установил таймер, но точный экран заставки не наступает. После этого все идет. Пожалуйста помоги. Благодарю.
Код для Splash Activity
:
public class SplashScreen extends Activity {
// Splash screen timer
private static int SPLASH_TIME_OUT = 3000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.content_splash_screen);
new Handler().postDelayed(new Runnable() {
/*
* Showing splash screen with a timer. This will be useful when you
* want to show case your app logo/company
*/
@Override
public void run() {
// This method will be executed once the timer is over
// Start your app main activity
Intent i = new Intent(SplashScreen.this, LoginActivity.class);
startActivity(i);
// close this activity
finish();
}
}, SPLASH_TIME_OUT);
}
}
Опубликовать код вашей деятельности Splash. –
Есть ли у вас код, чтобы показать нам? – Rohit5k2
Скопируйте вставьте свой код. Нет изображений. – Rohit5k2