Using the AppCompat library (3.52) and this is the text of the manifest file (in case that is relevant):
In Main, Globals I have this:
The menu is created like this:
Now if the keyboard is showing and the user clicks the overflow menu icon (3 vertical dots) then
the overflow menu won't show fully, so I need to hide the keyboard before the menu is opened.
I tried this, but although that will hide the keyboard the overflow menu is still not showing fully:
So, how can I hide the keyboard before the overflow menu opens?
RBS
B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="26"/>
android:normalScreens="true"
android:smallScreens="true"
android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetApplicationAttribute(android:supportsRtl, "true")
'SetApplicationAttribute(android:largeHeap, "true")
'AddPermission(android.permission.USE_FINGERPRINT)
'End of default text.
'SetApplicationAttribute(android:hardwareAccelerated, "false")
'End of default text.
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
'CreateResourceFromFile(Macro, Themes.LightTheme)
SetActivityAttribute(Main, android:windowSoftInputMode, adjustResize)
'SetActivityAttribute(Main, android:windowSoftInputMode, adjustPan)
CreateResource(values, themes.xml,
<resources>
<dimen name="action_button_padding">0dp</dimen>
<style name="MyAppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="colorPrimary">#FF9800</item>
<item name="colorPrimaryDark">#F57C00</item>
<item name="colorAccent">#FFA726</item>
<item name="windowNoTitle">true</item>
<item name="windowActionBar">false</item>
<item name="windowActionModeOverlay">true</item>
<item name="android:actionButtonStyle">@style/ActionButton</item>
<item name="android:listPreferredItemHeightSmall">30dp</item>
</style>
<style name="ActionButton" parent="@android:style/Widget.ActionButton">
<item name="android:paddingStart">0dp</item>
<item name="android:paddingEnd">2dp</item>
<item name="android:minWidth">2dp</item>
<item name="android:drawablePadding">@dimen/action_button_padding</item>
</style>
</resources>
)
In Main, Globals I have this:
B4X:
Private ActionBar As ACToolBarLight
The menu is created like this:
B4X:
#IgnoreWarnings: 11
Sub Activity_CreateMenu(Menu As ACMenu)
Dim i As Int
Dim item As ACMenuItem
Menu.Clear
'initialize with default value (not in menu group)
'-------------------------------------------------
For i = 0 To 21
arrMenuIconsInfo(i, 0) = -1
Next
'Menu group 1
For i = eMenuButtonType.FindPatient To eMenuButtonType.Map '0 to 7
item = Menu.AddWithGroup2(1, i, i, arrMenuIconFilesTitles(i, 2), arrMenuIcons(i, 0))
item.ShowAsAction = item.SHOW_AS_ACTION_ALWAYS
arrMenuIconsInfo(i, 0) = 1
arrMenuItems(i) = item
Next
'Menu group 2
For i = eMenuButtonType.Appointments To eMenuButtonType.Phone_Patient '8 to 14
item = Menu.AddWithGroup2(2, i, i, arrMenuIconFilesTitles(i, 2), arrMenuIcons(i, 0))
item.ShowAsAction = item.SHOW_AS_ACTION_ALWAYS
arrMenuIconsInfo(i, 0) = 2
arrMenuItems(i) = item
Next
'Menu group 3
For i = eMenuButtonType.SQL To eMenuButtonType.Show_All_Run_SQL '15 to 21
item = Menu.AddWithGroup2(3, i, i, arrMenuIconFilesTitles(i, 2), arrMenuIcons(i, 0))
item.ShowAsAction = item.SHOW_AS_ACTION_ALWAYS
arrMenuIconsInfo(i, 0) = 3
arrMenuItems(i) = item
Next
ActionBar.Menu.SetGroupVisible(2, False)
ActionBar.Menu.SetGroupVisible(3, False)
ActionBar.Menu.SetGroupVisible(1, True)
iCurrentMenuGroup = 1
'overflow menu (3 dots)
'----------------------
For i = eMenuButtonType.Export2CSV To eMenuButtonType.Dev_Test '21 to 45
AddOverflowMenuItem(Menu, i)
Next
End Sub
Sub AddOverflowMenuItem(Menu As ACMenu, iIDX As Int)
Dim item As ACMenuItem
item = Menu.Add(iIDX, iIDX, arrMenuIconFilesTitles(iIDX, 2), Null)
arrMenuItems(iIDX) = item
End Sub
Now if the keyboard is showing and the user clicks the overflow menu icon (3 vertical dots) then
the overflow menu won't show fully, so I need to hide the keyboard before the menu is opened.
I tried this, but although that will hide the keyboard the overflow menu is still not showing fully:
B4X:
#If Java
public boolean _onCreateOptionsMenu(android.view.Menu menu) {
if (processBA.subExists("activity_createmenu")) {
processBA.raiseEvent2(null, true, "activity_createmenu", false, new de.amberhome.objects.appcompat.ACMenuWrapper(menu));
return true;
}
else
return false;
}
@Override
public boolean onMenuOpened(int featureId, android.view.Menu menu) {
if (menu != null) {
processBA.raiseEvent(null, "activity_menuopen");
}
return super.onMenuOpened(featureId, menu);
}
#End If
Sub Activity_MenuOpen
ime.HideKeyboard
End Sub
So, how can I hide the keyboard before the overflow menu opens?
RBS