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.

Custom Fragment is dimmed

See original GitHub issue

AppIntro Version: 4.1.0

Device/Android Version: Android 6.1, 5.1

Issue details / Repro steps / Use case background: I was trying to add a custom fragment instead of using the default AppIntroFragment. I can add the custom fragment, but the entire screen is dimmed.

Your Code: Custom Fragment:

public class CustomTutorialFragment extends Fragment {
    private static final String ARG_LAYOUT_RES_ID = "layoutResId";
    private int layoutResId;

    public static CustomTutorialFragment newInstance(int layoutResId) {
        CustomTutorialFragment sampleSlide = new CustomTutorialFragment();

        Bundle args = new Bundle();
        args.putInt(ARG_LAYOUT_RES_ID, layoutResId);
        sampleSlide.setArguments(args);

        return sampleSlide;
    }

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

        if (getArguments() != null && getArguments().containsKey(ARG_LAYOUT_RES_ID)) {
            layoutResId = getArguments().getInt(ARG_LAYOUT_RES_ID);
        }
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        return inflater.inflate(layoutResId, container, false);


    }

}

Custom Fragment Layout:

<?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:gravity="center">

    <ImageView
        android:id="@+id/tutorial_image"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:paddingTop="80dp"
        android:paddingLeft="16dp"
        android:paddingRight="16dp"
        android:src="@drawable/update_icon"
        android:layout_gravity="center_horizontal"/>

    <TextView
        android:id="@+id/tutorial_description"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_horizontal"
        android:gravity="center"
        android:paddingLeft="64dp"
        android:paddingRight="64dp"
        android:paddingTop="64dp"
        android:textSize="16sp"
        android:text="bla bla bla"/>

</LinearLayout>

Tutorial Activity:

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.graphics.Color;
import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.text.TextUtils;

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


public class TutorialSlidePageActivity extends AppIntro {


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

        addSlide(CustomTutorialFragment.newInstance(R.layout.tutorial_fragment));
        addSlide(CustomTutorialFragment.newInstance(R.layout.tutorial_fragment));
      }

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

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

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

Stack trace / LogCat: No errors

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

2reactions
marlene89commented, Nov 22, 2016

OMG I’m impressed with the fast response. I was settling into the wait for a response which I thought could take weeks. Thank you so much for your help. Adding a background color did fix the issue. I dissected the custom layouts you had in your example app, but I knew I was overlooking something, Thank you so much again 😃 I will mark the issue as closed. Have a nice Thanksgiving.

On Nov 21, 2016, at 5:25 PM, Andrew Quebe notifications@github.com wrote:

I’d also recommend using white tinted drawables and text to match the library’s bar text and buttons…unless you intend to change those colors later.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/paolorotolo/AppIntro/issues/360#issuecomment-262120554, or mute the thread https://github.com/notifications/unsubscribe-auth/ARG3l9CTSI-cZaaU4vLKFYoo0SUdwKsCks5rAkSMgaJpZM4K45Oe.

0reactions
Sammiches327commented, Nov 22, 2016

@marlene89 I just happened to be on my computer when I got the email…no worries 😃 Glad your issue is solved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DialogFragment with clear background (not dimmed)
I'm trying to get the background of a DialogFragment to be completely clear. With setting the ...
Read more >
Custom Fragment is dimmed · Issue #360 · AppIntro ... - GitHub
Issue details / Repro steps / Use case background: I was trying to add a custom fragment instead of using the default AppIntroFragment....
Read more >
Displaying dialogs with DialogFragment - Android Developers
A DialogFragment is a special fragment subclass that is designed for ... you need to perform any custom logic when your Dialog is...
Read more >
Fragment transaction custom animations have wrong z ordering
When setting a custom transition on a support v22 fragment transaction to ... which produces an brief dimming effect as the view's alpha...
Read more >
How to stream XML fragments from an XmlReader - LINQ to ...
You can stream XML fragments from an XmlReader using a custom axis method in C# and Visual Basic. This is an approach that...
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