AHQuickAction library - Nice looking popup menus

melamoud

Active Member
Licensed User
Longtime User
what I'm suggesting is adding another panel / component that will place exactly where you want the pop up to be, and since it is of the size of 1:1 it does not matter if the popup goes to the up/bottom/right/left side of it

do not attach the popup to the button but to the new invisible panel - am I missing something ?
 

corwin42

Expert
Licensed User
Longtime User
Hi,

I have an screen where i have placed a button(M) at the right of the screen so i want the pop up menu arrow to come from the left of the button.

is it possible to do it. kindly let me know how i can go about it.

PFA the image of the screen

This is not possible with the library. As you said the popup window pops up above or below the anchor view. There is currently no way to let it pop up "left" or "right" from the anchor view.

You may try to change the source (see Github repository in my signature) to implement this feature but you will also have to create new images for the arrow etc.
 

bashka_abdyli

Member
Licensed User
Longtime User
A better solution using Reflection library:
B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
   ac1.Show(GetViewAtPos(Sender, Position))
End Sub

Sub GetViewAtPos(LV As ListView, Position As Int) As View
   Dim r As Reflector
   Dim v As View
   r.Target = LV
   Dim first As Int
   first = r.RunMethod("getFirstVisiblePosition")
   v = r.RunMethod2("getChildAt", Position - first, "java.lang.int")
   Return v
End Sub
Hi Erel,
Is this also possible for the Webview ?
 

bashka_abdyli

Member
Licensed User
Longtime User
How is this code related to a WebView?

Hi Erel,

Well what I what is I am using Webview to show data (like grid using HttpUtils class). What I would want is to show this AHQuickAction same way that it works in listview based on code you provided.

In my case it shows the AHQuickAction in the same place every time, no matter what I click on Webview.
 

corwin42

Expert
Licensed User
Longtime User
menu items font can only be changed in the xml layout files for the item.
different fonts and sizes are not possible directly. Maybe it is possible with reflection library but I haven't looked into it.
 

CapReed

Member
Licensed User
Longtime User
Good night,

It took a couple of hours trying to find the XML that allows me to show the 3D drop with white background and the letters a little bigger and black. I've tried all, and I'm starting to despair. :confused:

Could you tell me which is the xml in question, and what changes I have to do? I have seen that version 1.1 allows ICS appearance, would it be possible for me to do indicaseis like?

Thank you very much for your attention, and as always, sorry for my bad English. ;)
 

CapReed

Member
Licensed User
Longtime User
I've done it!

Leave these instructions if you can be of help to some other partner:

Ahqa_action_item_vertical.xml file that is inside the folder objetcs / res / layout we serve to change the size and color of the text.

B4X:
<TextView
android: id = "@ + id / tv_title"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: gravity = "center_vertical"
android: paddingLeft = "5dip"
android: paddingRight = "10dip"
android: text = "Chart"
android: textsize = "24DIP"
android: textColor = "#000" />

I have put 24DIP and text color I put in black.

Then you have to vary the ahqa3d_popup.9 arhivo this within the Objects folder / res / drawable. Currently this a square black (to my understanding very ugly :p), I've changed by another the other with a gradient. Keep in mind that this file is a 9.png and therefore have to work previously with some NinePatch retouching tool.

If you do not like the small triangle that appears below the dropdown, you can edit the png file and completely remove ahqa3d_arrow_down/ahqa3d_arrow_up, leaving only the transparent square area. I think this could also be achieved by modifying some other xml, but honestly, after so many hours spent on these small details rather not see more xml in a while ... Do you know how hard it is to use the translator of google for all! ;)

After changing all the comments, and have put VERY IMPORTANT READ ONLY files, you have to clean the project and run it so you can see the difference.

I hope I have said no nonsense, and if I did, I hope the author of this magnificent library knows forgive. :rolleyes:

Thank you all!
 

Lello1964

Well-Known Member
Licensed User
Longtime User
Hello,

it's possibile have a LongClick event on this Library ?

Thanks

Raffaele
 

elitevenkat

Active Member
Licensed User
Longtime User
Hi
How to increase the Text Size of the items listed in vertical menu ? Also is there anyway to double space each menu item ?
 

elitevenkat

Active Member
Licensed User
Longtime User
Hi corwin42,
the particular line " android: textsize = "24DIP" " is not found in the Ahqa_action_item_vertical.xml . However I inserted the line and of course got the following error promptly thrown by the compiler!!!
Parsing code. 0.02
Compiling code. 0.04
Compiling layouts code. 0.00
Generating R file. Error
res\layout\ahqa_action_item_vertical.xml:15: error: No resource identifier found for attribute 'textsize' in package 'android'
Thanks
venkat
 

corwin42

Expert
Licensed User
Longtime User
There should be a android:textsize property in all action item xml files. You have to change the textsize of the textview with the id="@+id/tv_title". Don't use a space between android: and textsize. Textsize should be specified in sp not dip.
 

Harris

Expert
Licensed User
Longtime User
I've done it!

Leave these instructions if you can be of help to some other partner:

Ahqa_action_item_vertical.xml file that is inside the folder objetcs / res / layout we serve to change the size and color of the text.

B4X:
<TextView
android: id = "@ + id / tv_title"
android: layout_width = "fill_parent"
android: layout_height = "fill_parent"
android: gravity = "center_vertical"
android: paddingLeft = "5dip"
android: paddingRight = "10dip"
android: text = "Chart"
android: textsize = "24DIP"
android: textColor = "#000" />

I have put 24DIP and text color I put in black.

Then you have to vary the ahqa3d_popup.9 arhivo this within the Objects folder / res / drawable. Currently this a square black (to my understanding very ugly :p), I've changed by another the other with a gradient. Keep in mind that this file is a 9.png and therefore have to work previously with some NinePatch retouching tool.

If you do not like the small triangle that appears below the dropdown, you can edit the png file and completely remove ahqa3d_arrow_down/ahqa3d_arrow_up, leaving only the transparent square area. I think this could also be achieved by modifying some other xml, but honestly, after so many hours spent on these small details rather not see more xml in a while ... Do you know how hard it is to use the translator of google for all! ;)

After changing all the comments, and have put VERY IMPORTANT READ ONLY files, you have to clean the project and run it so you can see the difference.

I hope I have said no nonsense, and if I did, I hope the author of this magnificent library knows forgive. :rolleyes:

Thank you all!


I have some understanding of what you have done here...
android: textsize = "24DIP" doesn't work here - gives error when compiling.
android: textsize = "24pt" works fine (gives larger font size)

My issue is the default 9pt works fine on phones but is rather small on tablets.
How can I change the font size programatically when displayed on a tablet?
I can't figure this out.

Thanks
 

corwin42

Expert
Licensed User
Longtime User
I think it is dp for xml layouts and not dip. Fonts should be specified with sp.

You can create different layout folders for different screen sizes. See here how it is done with XML.

So create a layout-sw600dp folder and put the ahqa_action_item_vertical.xml file there and change the textsize in this file. On a phone the xml-file from the normal layout folder will be used. On a tablet the xml file from the layout-sw600dp folder will be used. You only need to copy the xml files to the layout-sw600dp folder which differ from the default file.
 

Harris

Expert
Licensed User
Longtime User
I think it is dp for xml layouts and not dip. Fonts should be specified with sp.

You can create different layout folders for different screen sizes. See here how it is done with XML.

So create a layout-sw600dp folder and put the ahqa_action_item_vertical.xml file there and change the textsize in this file. On a phone the xml-file from the normal layout folder will be used. On a tablet the xml file from the layout-sw600dp folder will be used. You only need to copy the xml files to the layout-sw600dp folder which differ from the default file.

That looks easy. I shall give it a try.
Thanks Kindly.

Edit: That WAS easy... Thanks again.
(horizontal is a bit more challenging)
 
Last edited:

jfranz

Member
Licensed User
Longtime User
I am having a problem with running both the example here and the one posted for Informatix's ActionBar. I installed the latest version of the library files for both AHQuickAction and Reflection (just in case) and simply tried to run the examples. I get to the ac1.Initialize("AC") and get the exception "android.content.res.Resources$NotFoundException: Resource ID #0x0.

The last thing the log says it was calling android.content.res.Resources.getValue() and before that android.content.res.Resources.loadXmlResourceParser().

I have tried this in both version 3.0 and 2.7 and am using Android version 4.1.2

Any clue on what is happening or what to try to get this to work?

Thanks.
 
Top