Open sgkhode opened 9 years ago
+1
I had the same problem and I think it's because ActionBarActivity returns null in method getActionBar().
You should try using this class instead of FadingActionBarHelper:
package com.example.custom;
import android.app.Activity;
import android.graphics.drawable.Drawable;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarActivity;
import com.manuelpeinado.fadingactionbar.FadingActionBarHelperBase;
public class MyFadingActionBarHelper extends FadingActionBarHelperBase {
private ActionBar mActionBar;
@Override
protected int getActionBarHeight() {
return mActionBar.getHeight();
}
@Override
protected boolean isActionBarNull() {
return mActionBar == null;
}
@Override
protected void setActionBarBackgroundDrawable(Drawable drawable) {
mActionBar.setBackgroundDrawable(drawable);
}
@Override
public void initActionBar(Activity activity) {
mActionBar = ((ActionBarActivity) activity).getSupportActionBar();
super.initActionBar(activity);
}
}
Notice that MyFadingActionBarHelper is using android.support.v7.app.ActionBar, where FadingActionBarHelper is using android.app.ActionBar as seen here.
Hope this helps! :)
Hey thanks, it's partially worked. I've managed to get it within an activity but I still to mess around with Activity Bar colours. Really appreciate that!
@JKMirko was yours doing similar?
Take a look at the links below. I think this could be a solution because it seems you didn't make your ActionBar transparent.
Here you can find themes and styles which make ActionBar transparent. Check out AndroidManifest.xml to see how these themes are applied.
Hope this helps! :)
I am trying to add some text to header but the headerOverlayLayout doesn't work. Has anyone done this?
I had the same issue and just solved it. I was using FadingActionBarHelper without the proper themes, styles, and manifest declarations.
You should make sure you Android Manifest
JKMirko's Jan 21 dated solution works fine. Thanks. Btw, replace ActionBarActivity with AppCompatActivity to get it to work.
Anyone planning to fix this ?
Hello, Here is my code, but I am getting error at line initActionBar package com.krishinomy.farmweather;
import android.support.v7.app.ActionBarActivity; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.widget.ArrayAdapter; import android.widget.ListView;
import com.manuelpeinado.fadingactionbar.FadingActionBarHelper;
public class WeatherDetailsActivity extends ActionBarActivity {
}
can anyone guide me what could be issue?
Thanks