Я пытаюсь создать заставку. Я добавил фоновое изображение для заставки экрана xml. Фоновое изображение имеет размер всего 382 kb. но он не появляется. Но в предварительном просмотре он показывает мне изображение.Фон заставки не отображается
Вот файл XML
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back_ground"
tools:context="com.wisaver.app.updated.activities.SplashSecond">
</RelativeLayout>
другой всплеск XML
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back_ground_2"
tools:context=".updated.activities.SplashActivity">
<!--<ImageView
android:id="@+id/ic_splash"
android:layout_gravity="center"
android:background="@drawable/back_ground_2"
android:layout_width="fill_parent"
android:layout_height="fill_parent" />-->
<ImageView
android:id="@+id/iv_splash"
android:layout_gravity="center"
android:background="@drawable/logo"
android:layout_width="300sp"
android:layout_height="140dp" />
</FrameLayout>
Manifest
<activity
android:name=".updated.activities.SplashActivity"
android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name=".updated.activities.SplashSecond"
android:screenOrientation="portrait" />
Я тестирую его на Nexus 5. Я разрабатываю приложение с buildToolsVersion 24,0 +0,0. Как заставить его работать? Некоторая помощь здесь ценится.
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash);
Thread th=new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(1000);
startActivity(new Intent(SplashActivity.this,SplashSecond.class));
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
th.start();
}
}
Вот еще один
public class SplashSecond extends AppCompatActivity {
//boolean letGo=true;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash_second);
Thread th=new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(400);
startActivity(new Intent(SplashSecond.this,ConsumerRetailerActivity.class));
finish();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
});
}
он должен работать. – Androider
Точно это должно сработать, но это не так :( –
вы можете опубликовать свой код SplashActivity? –