I want to remove my app action bar but when I tried it using this:
android:theme="#style/Theme.AppCompat.NoActionBar"
My whole app changed to sort of dark gray (pics attached)
it,s so easy in MainActivity put this line getSupportActionBar().hide();
Related
I am trying to show the title bar of my android app on some layouts but not on others. I navigate between layouts without a problem and I call getSupportActionBar().hide(); or getSupportActionBar().show(); without problems, the titlebar does indeed show or hide when I want it to. However, there is an animation which is very ugly and annoying plus it causes some strange graphics problems (black background in my app but it shows a white background in the place of the title bar during its animation)
There is a method for disabling the animation but it does not seem to work at all. How can I have a title bar one one activity but not the other without having an annoying animation to show/hide it? And why cant I just call the method and have it work as it should?
The method I am trying to call is getSupportActionBar().setShowHideAnimationEnabled(false);
it is worth noting that my app is extremely simple and only has two layouts and one java activity. I just inflate two different layouts to show on my one activity.
How it looks like currently: https://i.imgur.com/djTWokI.mp4
<activity android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Black.NoTitleBar.Fullscreen">
You can try changing AndroidManifest.xml like this
I sort of solved it myself by creating a custom titlebar which I have full control over. What really frustrated me was that setShowHideAnimationEnabled(boolean) doesnt seem to work properly and I couldnt find any official documentation about it.
Googling for it only gave me results from like 2010 about how to enable animations but when animations are enabled by default, I wanted to remove them.
Anyway, turning the actionbar off in the entire application/activity is possible and that is what I did, I then created my own custom actionbar layout and added it to the page(s) that I want to utilize it.
If your context is an activity you can call overridePendingTransition:
Call immediately after one of the flavors of startActivity(Intent) or
finish specifying an explicit transition animation to perform next.
So, programmatically:
startActivity(new Intent(CurrentActivity.this, YourNextActivity.class));
overridePendingTransition(0, 0);
I want to change the ActionBarSherlock color permanently, I tried the following code but, when I reopen the application it resets to the previous color
getSupportActionBar().setBackgroundDrawable(new ColorDrawable(color));
My intentions are to make a theme that changes the ActionBarSherlock color with user input
First of all, stop using ActionBarSherlock. Use the AppCompat library provided by Android.
Secondly use ActionBar Style Generator to apply style (color) to the ActionBar
Similar questions have been asked before, but I couldn't find an answer to how to make one element full screen. I would like to temporarily display a full-screen animation in my Android app without moving to a new Activity. The app has an ImageView for the animation and I show the animation with:
image.setBackground(animation);
and make it "go away" with:
image.setBackground(null);
For the ImageView, both android:layout_width and android:layout_height are set to "match_parent". It works, but of course the animation doesn't include the title bar at the top or the icons at the bottom. I even tried setting the layout_marginTop and layout_marginBottom to negative values, but I know that can't be the best solution for every device or orientation which may run this app.
How can I change the size of the ImageView to full screen so I can show it as needed, or is there a better way to do what I want?
Duplicate of Fullscreen Activity in Android?.
Just set the right flags and dismiss the activity when it's finished its animation.
Your ImageView is stuck inside the bounds of your Activity. And I don't think there is a way for you to change your Activity to be full screen sometimes but not others.
If you want your Activity to be fullscreen always you can set the theme in the manifest like this:
<activity
android:name="com.your.package.name.YourActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.NoTitleBar.Fullscreen">
</activity>
Combine both answers. Create a new activity to play your animation and set the theme of your animation activity to fullscreen.
I just wanted to know if it possible to remove the top name bar when im using tabs?
I tryed to remove it by using
requestWindowFeature(Window.FEATURE_NO_TITLE);
but its crashing and telling me that the tabs are null, its logical.
Is there anther way for this?
http://i62.tinypic.com/2dijbys.png
// Remove title
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
Add this code before setContentView
it working for me.
You can use
getActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
To disable the icon and title in the ActionBar.
Note if you are using App Compat (i.e., extending ActionBarActivity), you'd instead use
getSupportActionBar().setDisplayOptions(0, ActionBar.DISPLAY_SHOW_HOME);
I'm implementing NavigationDrawer with ActionBarSherlock and now I'm trying to implement custom icon for opening and closing the drawer. I already set my own icon (white) but I'm not able to get rid of that grey default icon.
in onCreateOptionsMenu I'm doing this:
getSupportActionBar().setDisplayShowTitleEnabled(false); // does not display activity title
getSupportActionBar().setBackgroundDrawable(
getResources().getDrawable(R.drawable.actionbar_background)); // blue background
getSupportActionBar().setIcon(R.drawable.side_menu_button); // white icon
The picture shows difference when navigation drawer is closed (first) and open (second picture).
Is there any way to do it programmatically? Or is there even some way to do it? I hope it is.
Thank you.
EDIT: This is what I'm trying to achieve:
What you are currently doing is setting the icon on the ActionBar, which is different from setting the icon of the ActionBarDrawerToggle, which is what you want to be dealing with. If you look at the documentation (http://developer.android.com/reference/android/support/v4/app/ActionBarDrawerToggle.html) and find the constructor, you'll see there's a place to specify a custom Drawable to be used by the toggle.