No ActionBar and no StatusBar in android studio 3.3 - android

In the below image you can see that there is no ActionBar and StatusBar in the preview of any XML layout file, if anyone is facing the same issue and has solution please post it.

I faced the same issue, and got this:
No ActionBar visible
Change a setting for Show Layout Decorations (By Default it is unchecked, just check it and ActionBar will be there)
Visible ActionBar

Select the theme from above which have action bar by clicking where AppTheme is written in top pane of preview window.

Related

UI bug for the light theme (Fragment)

I've created a new project in Android Studio and there is a UI bug for the interface and I am not able to fix it. I don't understand what is this problem.
Basically it appears a top margin / a top padding for the fragment. In the "night theme" the problem is not present and the only thing I change between light and night is colours (in styles>themes)...
I explain a moment the structure of my project: there is the main activity, which contains "Nav_menu" and the "Fragment" view. This problem is present is all the fragments, so I thought it was a problem in Main... but I cannot understand actually.
I set manually 0dp to padding and margin, but nothing changes... do any others got this problem?
Let me show some images:
I think you use theme action bar set to be true, In every fragment action bar or title bar is showing because fragment is opening through an activity, try to set false for action bar or whatever in style theme

Dynamically change actionbar color while using a navigation drawer

I'm working on a project where I need to change the actionbar color within a single activity multiple times according to the content. This is done using
bar.setBackgroundDrawable(colorDrawable);
WITH this line, a portion of the actionbar turns transparent/grey (base theme is #style/Theme.AppCompat.Light.DarkActionBar) as soon as the navigation drawer is opened.
WITHOUT it, the background stays solid as expected even when the navigation drawer is opened. However, this does not allow for diffrent colored pages.
I'm using the support actionbar from appcompat 7, but it can be reproduced with a Toolbar as well as on multiple android versions.
Any ideas WHY this happens? Have I just messed up or is this in fact a bug?
Any workarounds, apart from setting a fixed color for the actionbar?
Note the right area of the actionbar that has become grey/transparent after opening the navigation drawer
I solved it. Kind of...
Please post other solutions if you can improve on this, as it is not the cleanest solution.
Changing the above mentioned
bar.setBackgroundDrawable(colorDrawable);
to
bar.setBackgroundDrawable(new ColorDrawable(((ColorDrawable) colorDrawable).getColor()));
solved the problem for me. This really should not have to be done though.

Title bar doesn't show on emulator but shows in eclipse?

I don't want an activity in my app to show the title bar. So I added the following line to that activity in the manifest: android:theme="#android:style/Theme.Black.NoTitleBar". Now that activity does not show the title bar, but the graphical layout editor section in eclipse shows it. I need to get rid of the title bar in eclipse too. How do I remove it from eclipse's graphical layout editor?
Depending on your version of Eclipse, there should be a drop-down menu below at the top of tht view. The Themes can be selected from there. It let's you do it this way so that you can see what your app will look like with different themes.
There is a dropdown above the graphical layout editor. This screenshot might help you -

ActionBarSherlock wrong tabs position on android 2.2.2

I'm having serious problems getting tabs in actionbarsherlock below main action bar tabs to work in an app that runs from Android 2.2 up and looks like Android 4. (see link)
Tabs position
Have you tried running the official Demos app of ActionBar Sherlock? (https://github.com/downloads/JakeWharton/ActionBarSherlock/ActionBarSherlock-Sample-Demos-4.2.0.apk) It should contain a demo for the actionbar with Tabs.
If that works on Android 2.2 then you know the problem is in your code and you can check the Demos source code to see what you are doing differently (https://github.com/JakeWharton/ActionBarSherlock/tree/master/samples).
It's usual behavior of action bar (actionbarsherlock just simulate it). Use
ActionBar act = getSupportActionBar();
act.setStackedBackgroundDrawable(getResources().getDrawable(R.drawable.mytab_base_t));
to avoid white color in top bar (this option you can't access from any theme item yet). You can also monitor action bar height to change custom view of tabs on-fly, but you can't change action bar behavior, forget it. Otherwise please use PagerTitleStrip against action bar tabs.

Actionbar's Home up arrow is not showing when display options are set in XML

I couldn't find anything over the web about my problem, so I figured I'd share it here.
My problem: I am working on a tablet app, and it has an ActionBar. Said ActionBar's display options were previously set in my Activities' onCreate through:
final ActionBar
bar = getActionBar();
bar.setDisplayOptions(ActionBar.DISPLAY_HOME_AS_UP|ActionBar.DISPLAY_SHOW_HOME|ActionBar.DISPLAY_USE_LOGO);
Everything was going on fine back then, an arrow was displayed on the home icon automatically to show to the user that he could navigate up.
Now, I'd like to set it through an XML style - that I already had for background, but just though about using for display options. Here's how I do it:
<!-- actionbar's style -->
<style name="Widget.myProject.Light.ActionBar" parent="android:style/Widget.Holo.Light.ActionBar">
<item name="android:background">#drawable/bg_action_bar</item>
<item name="android:displayOptions">homeAsUp|useLogo|showHome</item>
</style>
The problem with that new way of doing it is that the arrow on the home icon is not showing up on my Android 3.2 tablet. Whether I set the display options programmatically or not, as long as I set it in the XML, it fails to display it.
Has anyone ever faced this situation and somehow found a way to solve it?
For me works only this code:
ActionBar actionBar = getActionBar();
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
if you're using android.support.v7.app.ActionBarActivity then do this:
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
More info can be found here:
http://developer.android.com/training/implementing-navigation/ancestral.html
If you're using v7.app.actionBar and with holo.theme use this :
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
The code work great.
Here is a simple way:
getActionBar().setDisplayHomeAsUpEnabled(true);

Categories

Resources