Android ActionBar actionBarSize (bar height) does not work in Portrait Mode - android-actionbar

To briefly explain my goal : I'm building an app to a public terminal on android. I'm trying to avoid the top finger pull Status/Notification Menu by the android os. I have not been able to prevent this Menu mechanism programmatically. To accomplish this goal, I'll have a custom made enclosure that'll cover top part of the screen for the android device. Enclosure will also cover home, back buttons.
I'm using android ActionBar (not Sherlock). Obviously the ActionBar tabs needs to move down a little to make room for the covered part by the enclosure. I set paddings for the actionbar through Theming.
Here is corresponding part of /res/values/themes.xml (AndroidManifest.xml is already set to use CustomTheme)
<style name="CustomTheme" parent="AppBaseTheme">
<item name="android:actionBarTabStyle">#style/MyActionBarTabStyle</item>
<item name="android:actionBarSize">#dimen/action_bar_default_height</item>
</style>
<style name="MyActionBarTabStyle" parent="#android:style/Widget.Holo.ActionBar.TabView">
<item name="android:paddingTop">#dimen/actionbar_paddingtop</item>
</style>
This works as expected in landscape mode. In portrait mode paddingtop will work, but action bar height will not adjust (actionBarSize don't work), so the ActionBar tab text will get cut off.
At first I tought dimen files could be the problem. I've tried generating /res/values-port copies of themes.xml and dimens.xml, but doesn't seem to be the problem. padding works after all. I've also tried putting in direct values like 90dp for actionBarSize, and 32dp for padding without any luck.
To me it appears portrait mode does not like actionBarSize. There is no similar question on the web related to this issue, maybe I'm missing something simple. Any help is appreciated.

This may be already too late to answer your question. I will just put this here.
Apparently, this is a bug from android sdk, check this link.
https://code.google.com/p/android/issues/detail?id=41792

Related

qradiobuttions are not visible

I developed a very simple qt application by using qt creator 4.6 on Mac (MacOs HighSierra Ver. 10.13.6 (17G65)). The application has a main window, a label with a picture and two radio button groups.
I compile and launch the program but only one radio button group is visible.... very strange.
I supposed that one radio button group is on the back of the picture so I sent to back the picture and put in front the radio button group but the result is the same.
Did you have any similar problem ? How did you fix it ?
Thank you very much for your help
regards
So... You have wrong ui form :) You have 2 widgets with the same name "layoutWidget". To fix it:
Close your project.
Open your ui file in text editor.
Rename layoutWidget(second (50 str)) to layoutWidget_2 (for example):
to
<widget class="QWidget" name="layoutWidget_2">
Open your project.
Right click on "label" (ui form) in "The Object Inspector" select "move back".
The problem is that for objects with the same names, zorder does not work as it should. The compiler automatically renames objects with the same names (the first one leaves with the same name, and the second, third, etc. calls it differently). But in zorder there are old names (not renamed).
PS. Sorry for my English.

Dialog forms flash quickly but aren't drawn properly after that

I have some legacy code made with Borland C++ Builder 6 that I have to port from Windows XP embedded to Windows 10 IoT.
It all seems to run properly, except dialog forms which aren't drawn properly. When I call ShowModal on the forms to show them, they flash quickly and then seems to disappear. However they are not gone, instead they are just not drawn and the form behind the dialog is seen. The dialog form buttons can still be pressed (if we know where they are).
I have tried all possible redrawing, refresh, repaint and update functions I could find, but nothing seems to work.
To make matters worse, dialogs containing actual control elements (like one containing a set of TSpeedButton elements) the controls are redrawn when moving the mouse over them, but anything else are not redrawn.
I have tried to search for similar issues but can't find anything for this.
Could this be solved? Or do we have to update to a newer Embarcadero version of the IDE to be able to solve it (which is a lot or work and not really something we can do at the moment)?
The problem was the use of a Billenium Software (now defunct) package for "fancy" transitions.
The transition in question "zooms" a dialog open, and it just doesn't seem to work. Disabling this transition will solve the problem of the disappearing dialogs.
I still don't know if it's a problem with the components Windows 10 compatibility, or with its 64-bit system compatibility.

Hiding a sizer and all its contents in wxWidgets using XRC

I am using an .xrc file to setup my wxWidgets GUI. For most GUI elements I can specify <hidden>1</hidden> and the element will not be drawn.
What I'd like is to be able to hide my wxStaticBoxSizer and have it and its contents not be drawn.
It's set up as follows, but adding <hidden>1</hidden> does not have any effect. The static box still draws as does everything it contains.
<object class="wxStaticBoxSizer" name="wxID_ANY">
<orient>wxVERTICAL</orient>
<label>Flight Formation</label>
<object class="sizeritem">
<flag>wxGROW|wxALL</flag>
<border>10</border>
<option>1</option>
Is it possible to hide this wxStaticBoxSizer from the .xrc file?
Quick hack: nest the sizer inside a wxPanel and hide the panel.
If you're willing to rebuild the XRC lib, here's a quick patch that will provide the functionality you need.
In src/xrc/xh_sizer.cpp, in the body of wxSizerXmlHandler::Handle_sizer(), add the following right after the call to CreateChildren(parent, true/*only this handler*/);:
// This has to be done after CreateChildren().
if(GetBool(wxT("hideitems"), 0) == 1)
sizer->ShowItems(false);
That's it. Rebuild the lib, and now you can specify <hideitems>1</hideitems> on a sizer, which means it will be created with all its items hidden.
This will handle all sizers except wxStdDialogButtonSizer, which has separate code. I tested it for wxBoxSizer and wxStaticBoxSizer using the XRC sample. I think I'll send a pull request to add this feature to wx; in the mean time, if anyone could do some more testing on this using a larger application, that would be great.
There is no way to hide the sizer in the XRC currently, the best you can do is to call wxSizer::ShowItems() from the code. It probably would make sense to support the "hidden" attribute for the sizers too in the future, although it should probably be called something else to avoid creating the erroneous impression that sizers are windows (which they aren't).
BTW, if you tried to validate your XRC, you would have found out that "hidden" element is not allowed here.

Custom font in actionbar on launch main activity

I'm looking for a way how I can change the font of the title in the actionbar before starting the main activity.
My current approach to change the font is the following:
int titleId = getResources().getIdentifier("action_bar_title", "id","android");
TextView textView = (TextView) findViewById(titleId);
textView .setTypeface(Typeface.createFromAsset(getAssets(), "my_font.ttf"));
This block of code is executed at the beginning of the onCreate method of the main activity. Actually, this works pretty well.
However, the small imperfection is only that when the application is launched, the title appears for a very short time in the default font before it changes. In my activity I use the DrawerLayout.
How can I change this behavior so that the text is displayed from the start in the right font?
Thank you for your help.
This is probably not possible. At least I have not found a way to accomplish this.
But I found a workaround that provides the same effect: You can design an image with the title and then define it in the styles.xml as the logo, for example:
...
<item name="android:logo">#drawable/ic_logo</item>
...
When the application is started up, the logo with the title can be removed again. As far as I've seen other apps (eg runtastic) use this technique as well.

Change homeAsUpIndicator dynamically

I build an app with four tabs and, as a consequence, four fragments. In the first fragment, I have a sliding menu and I throw with a custom icon in the actionbar. The problem is that in the others fragments, I want to stablish other custom icon to return to the first fragment but I don't know what to do...
This is my styles.xml with my custom icon for the sliding menu:
<!-- Application theme. -->
<style name="AppTheme" parent="AppBaseTheme">
<item name="android:homeAsUpIndicator">#drawable/menu32</item>
</style>
The java code works well but I don't know how to change the icon dynamically.
This is what I have:
You can use the following in your fragments:
Actionbar ab = getActivity().getActionBar();
ab.setIcon(icon);
Where icon is a Drawable or a resource id, when the up indicator is a part of your icon.
You can also use setHomeAsUpIndicator if you use API level > 11:
getActivity().getActionBar().setHomeAsUpIndicator(resId);
If your API level is lower, then I suggest you make use of ActionbarSherlock.