Currently you can only recreate the whole popup.
Good enough. Thank you for your help!
Currently you can only recreate the whole popup.
This can only be done by changing the xml files.
Das kannst Du nur in den xml Files ändern.
Gesendet von meinem LG-P500 mit Tapatalk 2
ok, danke, in welcher Datei und wie muss der Code aussehen ?
Can anybody share small sample project which shows how to use AHQuickAction with AHActionBar? :sign0163:
Looks perfect for me.
You should use this:
AB is the AHActionBarB4X:Sub AB_ItemClicked(ItemID As Int) Menu.show(AB.GetActionView(ItemID)) End Sub
Menu is the AHQuickAction3D
Sub AB_ItemClicked(ItemID As Int)
'If the refresh action is pressed, show the progress indicator a few seconds.
Select ItemID
Case ID_ACTION_REFRESH
ab.ProgressBarVisible = True
ab.SetActionVisibility(ID_ACTION_REFRESH, False)
Timer1.Enabled = True
Case ID_ACTION_HOME
Msgbox("Home action pressed", "Item clicked")
Case ID_ACTION_SHARE
Msgbox("Share some content ...", "Item clicked")
Case ID_ACTION_STAR
Msgbox("Star action pressed", "Item clicked")
Case ID_ACTION_OVERFLOW
'Msgbox("Open a Menu here (Perhaps with AHQuickAction popups)", "Item clicked")
'ac2.show(btnFake)
ac2.show(ab.GetActionView(ItemID))
End Select
End Sub
There's an alternative to this library if you have problems with it: ActionBar class.
java.lang.IndexOutOfBoundsException: index=5 count=0
at android.view.ViewGroup.addInArray(ViewGroup.java:2044)
at android.view.ViewGroup.addViewInner(ViewGroup.java:1988)
at android.view.ViewGroup.addView(ViewGroup.java:1865)
at android.view.ViewGroup.addView(ViewGroup.java:1822)
at de.amberhome.quickaction.QuickAction3D.addActionItem(QuickAction3D.java:218)
at mail.purge.main._vvvvvvvvvvvv4(main.java:852)
at mail.purge.main._activity_create(main.java:341)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at mail.purge.main.afterFirstLayout(main.java:84)
at mail.purge.main.access$100(main.java:16)
at mail.purge.main$WaitForLayout.run(main.java:72)
at android.os.Handler.handleCallback(Handler.java:587)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:123)
at android.app.ActivityThread.main(ActivityThread.java:4627)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:521)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
at dalvik.system.NativeStart.main(Native Method)
java.lang.IndexOutOfBoundsException: index=5 count=0
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim ac1 As AHQuickAction3D
End Sub
Sub Activity_Create(FirstTime As Boolean)
CreateMenu ' code minimized for brevity
End Sub
Sub CreateMenu
ac1.Initialize("AC", ac1.HORIZONTAL)
For i = 1 To 3
Dim ai As AHActionItem
Dim bd As BitmapDrawable
Dim Filename, Text As String
Select i
Case 1
Filename = "menu_ok.png"
Text = "Credits"
Case 2
Filename = "menu_info.png"
Text = "About"
Case 3
Filename = "menu_settings.png"
Text = "Settings"
End Select
'Initialize a bitmap drawable and the action item
bd.Initialize(LoadBitmap(File.DirAssets, Filename))
ai.Initialize(i, Text, bd)
ai.Selected = True
'Add the item to Quickaction popup
ac1.addActionItem(ai) ' NOTE - error occurs on this line
Next
End Sub
I have got it to load the popop menu when you select a item in the ListView but the popup displays at the bottom of the ListView.
Is there a way to display the popup menu at the location the item was selected rather than displaying it at the bottom?
Maybe my ListViewWithEvents library may help. With it, you can get the first and last visible item. With an easy computation, you can locate the position of the clicked item.
I took a look into the internal structure of the standard ListView and I think it should be possible to get the View with Reflection. Haven't tried it yet. I guess Erel would have to solution for it in minutes.
Unless I don't understand the problem properly, I believe Erel already posted the solution using the Reflection-library. Look here:
http://www.b4x.com/forum/additional-libraries-classes-official-updates/14563-ahquickaction-library-nice-looking-popup-menus-2.html#post83441
I am using it and it works nicely also on my Samsung S3 with ICS.
Sub LVSE_ItemClick (Position As Int, Value As Object)
ac1.Show(GetViewAtPos(Sender, Position))
End Sub
Sub GetViewAtPos(LV As ListViewWithScrollEvents, Position As Int) As View
Dim r As Reflector
Dim v As View
r.Target = LV
v = r.RunMethod2("getChildAt", Position - LVSE1.FirstVisibleItem, "java.lang.int")
Return v
End Sub