I want to implement in my android application a functionality like when a user clicks a button in header a small list view is popup having 5 values in the corner of the screen. Please give some suggestion, its urgent. Thanks in advance.
You mean a quick action menu ? Like this ?
If so, check this :
http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
It depends somewhat on the minimum SDK that you are targeting. If you are able to write your application with a minimum target of Android 3.0 (API Level 11), then there are at least two classes that you can use to accomplish creating a simple popup anchored to another view (in this case, your button):
ListPopupWindow
PopupMenu
Otherwise, you will need to do a little customization of PopupWindow, which is the class that many early QuickAction implementations are based on.
HTH
Design a listview inside it RelativeLayout view in that same layout and make it as invisible. once you click a button at the header you can make it visible. which shows the listview.
You can create a new Activity for popup and add android:theme="#android:style/Theme.Translucent.NoTitleBar" to Activity node in Manifest file.
Related
If i click on(+Add to group)Button then alert/Dialog like view should visible. How to implement view like this in android??
It could be simply implemented using android-popupwindow.
Examples:
http://mrbool.com/how-to-implement-popup-window-in-android/28285
Is there a simple example of the PopupWindow class using Android v2.0?
Basic Steps:
Create a layout in XML for the menu.
Inflate that layout and apply to the PopupWindow.
Acquire a reference to that button. (i.e. Add to Groups);
Find its absolute coordination on the window.
Use showAtLocation to show the menu in the appropriate location.
Note: AFAIK, there's a bunch of libraries out there which fit your requirements. So, don't reinvent the wheel.
It's doable. You have to manually create a custom layout that automatically gets dismissed after pressing the action item.
Here is a small android library to create the QuickAction dialog style:
QuickAction Library
For more info, read this article.
i am working on demo application.
have you any idea about popup menu in Android 2.1 version. actually working fine in android api level 11 and above..
reference url : http://www.sitepoint.com/build-intuitive-extensible-menus-in-android-with-java-and-xml-2/
yes, you can do this. you just need a little bit of Animation and its done. :) It will give the exact feeling like a pop-up menu. I have done this before.
you need to use Relative layout for this purpose, because they can overlap on each other.
On click event of button, you need to show the View (relative layout holding a custom menu in this case) with an animation say bounce animation. again click on same button will hide the view again with an animation.
I wish I could post the code here but I have to search where I put my project. :P ;)
I hope it will give a little idea about a totally customized pop-up menu.
I want to create a popup screen with multiple views, just like home screen but as a popup. As I am relatively new to android, so I am not aware if any such control is built in or do I need to use any library? or any hint would be helpful.
EDIT: I am looking for an alternation to viewpager, which is supported minimum on API8.
It sounds like a PopupWindow may be what you're looking for. Added, in API 1, this let's you add a View(s) dynamically or you can set the layout to an already created xml file.
A popup window that can be used to display an arbitrary view. The popup window is a floating container that appears on top of the current activity.
You also can create an Activity with whatever Layout you need in xml and give it a Dialog theme to make it look like a pop up by setting the
android:theme="#android:style/Theme.Dialog"
in the <activity> tag of the manifest
I found the answer from the comment #codeMagic's comment below his answer, so posting here for the reference:
for ViewPager alternative we can use ViewFlow or ViewPagerIndicator library, there minimum supported SDK are API level 1 & 4 respectively.
I would like to create a contextual menu for a listview similar to the one used by the google play music app in the listviews. (see screenshot. The triangle buttons open the menu for the album. and then one can select different options depending on the selected item.) But I've also seen this element in other apps.
https://lh5.ggpht.com/IvSpTcmdyUOC9GoX-x528xAzy9jEPjWCLcNcru4CBEcUNZ-YHo0y2TQHcGmuvOQ2zg
The Problem is that I neither know how to implement the triangle button correctly (is that just a normal imagebutton?) nor do I know how to open that popup window for each entry.
One approach I tried was using a spinner. But the problem is that the spinner always was as wide as the longest element in it and not just the triangle. Otherwise this would be a good solution. Is there a way to set the spinner to a smaller size and hide the horizontal line beneath it?
Or would a spinner be the complete wrong approach and I should solve this problem differently?
You should be using a Button or an ImageButton to trigger the PopupMenu. You could use Android Holo Colors to create the background image. Alternatively the Holo default spinner background should do the trick, too.
When the Button is clicked you should trigger a PopupMenu. The Android PopupMenu is for Android SDK API 11+. So if you're about to support lower versions you should consider external libraries like HoloEverywhere.
The Spinner Widget is not suitable for your purpose.
I have not really used the Music app before, but I would try to answer the question from what I understand from the screenshot. It seems to me that options that come up are presented in a simple Dialog. This dialog has a list that can be easily implemented as given here.
SO, what you can do is include a Button, or ImageView, or ImageButton or any other View in the list item and clicking on that will display the dialog.
I'm trying to find some information on how to create a menu that looks like the top of the menu for chrome for Android. I have tried experimenting with implementing icons for Android 4.0, but no luck. Tried googeling, but the only thing i found was an answer that said icons can't be implemented when API >= 11.
How does Chrome do it then? It's made for devices that's 4.0+!
Use popup list window to achieve this. As you can add header and footer to any list, you can create one linear layout with back forward and star like options.. Add that view to the popup window.
Any ListView can be associated with HeaderViewListAdapter, using this you can attach seperate layouts as a header and or footer to your listViews.
As Vinodkumar said, you can also use ListPopupWindow with HeaderViewListAdapters.
In the Android reference: HeaderViewListAdapter and ListPopupWindow