question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Background not changing from black!

See original GitHub issue

AppIntro Version: 4.2.2

Device/Android Version: Works great on every device. I use Yu Yureka as physical and Nexus 5X as emulated device for testing.

Issue details: The issue is that no matter what android:background property I add to my intro slides, it always shows up in black color which is nowhere used in my app code (I’ve checked the colors.xml file). In the code below I’ve used this method for my first three slides. But the second method to add slides works perfectly (in which we set a title, description, background and image). Why is that so? And how can I fix it to add my own color?

Your Code: slide_1.xml-

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/colorPrimary">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:textColor="#ffffff"
        android:textSize="54sp"
        android:gravity="center"
        android:text="This is Slide 1"/>


</LinearLayout>

colors.xml:-

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Primary color of the app (shown in the app bar) -->
    <color name="colorPrimary">#4d427a</color>

    <!-- Primary dark color of the app (shown in the status bar) -->
    <color name="colorPrimaryDark">#3e3469</color>

    <!-- Accent color of the app -->
    <color name="colorAccent">#d0706d</color>

    <!-- Text color for the details of the earthquake in the list item -->
    <color name="textColorEarthquakeDetails">#f07c55</color>

    <!-- Text color for the primary location of the earthquake in the list item -->
    <color name="textColorEarthquakeLocation">#3e3469</color>

    <!-- Color for an earthquake with magnitude 0 and 2 -->
    <color name="magnitude1">#4A7BA7</color>

    <!-- Magnitude circle color for an earthquake with magnitude between 2 and 3 -->
    <color name="magnitude2">#04B4B3</color>

    <!-- Magnitude circle color for an earthquake with magnitude between 3 and 4 -->
    <color name="magnitude3">#10CAC9</color>

    <!-- Magnitude circle color for an earthquake with magnitude between 4 and 5 -->
    <color name="magnitude4">#F5A623</color>

    <!-- Magnitude circle color for an earthquake with magnitude between 5 and 6 -->
    <color name="magnitude5">#FF7D50</color>

    <!-- Magnitude circle color for an earthquake with magnitude between 6 and 7 -->
    <color name="magnitude6">#FC6644</color>

    <!-- Magnitude circle color for an earthquake with magnitude between 7 and 8 -->
    <color name="magnitude7">#E75F40</color>

    <!-- Magnitude circle color for an earthquake with magnitude between 8 and 9 -->
    <color name="magnitude8">#E13A20</color>

    <!-- Magnitude circle color for an earthquake with magnitude between 9 and 10 -->
    <color name="magnitude9">#D93218</color>

    <!-- Magnitude circle color for an earthquake with magnitude over 10 -->
    <color name="magnitude10plus">#C03823</color>
</resources>

IntroActivity.java:-

package com.example.android.quakereport;

import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;

import com.github.paolorotolo.appintro.AppIntro;
import com.github.paolorotolo.appintro.AppIntroFragment;

public class IntroActivity extends AppIntro {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addSlide(SampleSlide.newInstance(R.layout.slide_1));
        addSlide(SampleSlide.newInstance(R.layout.slide_2));
        addSlide(SampleSlide.newInstance(R.layout.slide_3));

        addSlide(AppIntroFragment.newInstance("Welcome", "This is a description", R.drawable.magnitude_circle, getColor(R.color.colorAccent)));

        setBarColor(Color.parseColor("#3F51B5"));
        setSeparatorColor(Color.parseColor("#2196F3"));

        showSkipButton(false);
        setDepthAnimation();

        setVibrate(true);
        setVibrateIntensity(30);
    }

    @Override
    public void onSkipPressed(Fragment currentFragment) {
        super.onSkipPressed(currentFragment);
        finish();
    }

    @Override
    public void onDonePressed(Fragment currentFragment) {
        super.onDonePressed(currentFragment);
        finish();
    }

    @Override
    public void onSlideChanged(@Nullable Fragment oldFragment, @Nullable Fragment newFragment) {
        super.onSlideChanged(oldFragment, newFragment);
    }
}

Screenshots:-

Slide 1 Slide 1 screenshot Slide 4 Slide 4 screenshot

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
avluiscommented, Oct 20, 2017

Neat – closing this for now

There should be a guide in the wiki that describes how to implement this

1reaction
avluiscommented, Oct 20, 2017

BaseSlide as well?

Read more comments on GitHub >

github_iconTop Results From Across the Web

8 Ways to Fix the Black Desktop Background Display Issue on ...
1. Enable the “Show Desktop Background Image” Option · Press Win + I to open the System Settings. · Click the Ease of...
Read more >
Fix Black Desktop Background In Windows - AddictiveTips
Open the Control Panel app. Go to System and Security>Power Options. Click 'Change plan settings' next to the currently active power plan. Click ......
Read more >
How to Fix Black Desktop Background In Windows 10
1. Go to Settings > Personalization > click on Colors in the left pane. In the right-pane, scroll down and click on High...
Read more >
5 Ways to Fix Black Desktop Background on My Windows PC
Press Windows + I to open the Settings app and select Ease of Access. Ease of access to fix desktop background keeps going...
Read more >
Unable to change background picture in Windows 7
Resolves issues in which you cannot change your desktop background in Windows ... You see a black background even though you change your...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found