I want to create a popup/dialog which appears at the bottom left of my screen (my activity) and which fades out after a certain amount of time similar to a Toast, but such that it is more complex than a Toast in that it has its own layout (images etc). Anyone know whether this is possible with DialogFragment or PopupWindow or any other class? And, if so, which class might be best for this kind of requirement?
You could create a Toast with a custom view: http://developer.android.com/guide/topics/ui/notifiers/toasts.html
Related
Can you please tell me how to make this type of pop up? I do not need to design own component in drawable. I don't have much knowledge in Android.
1) First there is Title with blue background .
2) Second there is scrolling list view (without image) and buy button (without image).
Is it possible?
I Googled it to find out if we can make own button like that with some style?
Here is my image
You have to use a Dialog/Pop up in combination with a ListView you have to google that up because its a complex theme.
good look
Start from http://developer.android.com/guide/topics/ui/dialogs.html. You have to implement your own custom dialog layout, likely using a ListView (http://developer.android.com/guide/topics/ui/layout/listview.html).
I am using a hack to display an overlay over a picture in Google TV using a constant toast message.
I would like to know if there is a way to further modify the toast to remove the fade in and fade out effect. Ideally I would like the overlay to appear instantly.
Any help or direction would be greatly appreciated.
For this , i suggest we can use a layout(FrameLayout).
and by using a new layout above your current layout and adding view that looks similar to TOAST to the top layer
After that do one thing by making object of View as v
eg:-
View v;
v.setVisiblity(GONE);
v.setVisibility(VISIBLE);
This will make your view appear or hide.
You can use a FrameLayout and create a new Layout layer above your current layout and add a view that looks like toast to the top layer.
Then you can use: View.setVisiblity(GONE); and View.setVisibility(VISIBLE);
to make your view appear and hide instantly.
View.setVisibility Documentation
FrameLayout example
I like a fade-in effect, but I was in need to cancel a toast message immediately without fade-out effect, since the toast message remained shown for a short moment even when the Activity was already exited.
I came to this solution to close (or actually hide) my toast message t immediately:
((TextView)t.getView().findViewById(android.R.id.message)).setTextColor(Color.TRANSPARENT);
t.setText("");
t.getView().setBackgroundColor(Color.TRANSPARENT);
t.cancel();
I assume to set colors transparent is the only way to hide the fade effect with standard Toast layout.
I want to create a pop-up window (with black transparent background around it) that would appear above the application activity screen (by clicking on a button). This pop-up would contain a video player, a list of videos to be played and some other elements.
This pop-up has to be a fragment since I need to re-use it from other app fragments.
So my question is : what is the best way to achieve that? I personally see 2 options :
1) adding the pop-up as a fragment on the layout and to show + activate it whenever I need. But in that case, how can I put a black transparent background around it that would fill the whole screen?
2) using DialogFragment but it seems that this class is not very well-designed for this kind of stuff.
What do you think?
Thanks in advance.
DialogFragments are the suggested way to launch Dialog views from within a Fragment, so this is the solution I would suggest for you.
You can do pretty much anything you need within the DialogFragment. You will be in full control of the UI using this method.
Here is a SO discussion of the same point, with good info: Android DialogFragment vs Dialog
I am currently developing an android app that displays a list view. When an item from the list view is selected I would like a small window to appear from the bottom of the screen. This window will not cover the entire list view, but take up a small portion of the bottom. On this window will be a few buttons and a progress bar.
My question is would the best way to achieve this be through a popupwindow or is there something else to better suit this?
Thank you for your help.
you could use a Dialog with a custom View (Android Custom Dialog example). Or you can forgo the concept of the pop-up and just "fake it" by adding your "pop-up" View into your normal layout but setting it as invisible. Then when you want to show it make it Visible and populate it with the appropriate data.
I think I understood what you meant. Do you use ActionBarSherkock? If yes, then there is a splitactionbar which is ususally located on the bottom of the screen, when the screen is small. It looks like this:
http://wptrafficanalyzer.in/blog/wp-content/uploads/2012/07/actionbar_menu_sherlock_splitactionbar.png
Is this what you meant? Let me please know.
Edit:
There is something called quick actions. This handels popups very well, but its not displayed on the bottom of the screen tough. But you might want to look at it:
http://londatiga.net/images/quickactions/quickcontact.jpg
I am a little confused about the best way to show pause screen on my android game. will it be better to be a pauseMenuActivity or is it enough with just pauseDialog? this pause dialog will just show score, money, back button, option button , and quit button. if it is better to show dialog, I don't know how to show those buttons and background image.. anyone can help me? thank you
I would recommend going for a Dialog (or some other custom overlay). From my experience, inter-Activities transitions aren't always very quick and they can feel kind of sluggish in the context of a game. In my opinion, when I am on a pause screen and want to start playing again, it should be instantaneous.
Plus, an Activity is kind of overkill if you just want to show 4 buttons.
To create a custom dialog containing a custom layout, have a look at the following tutorial and post again if you have specific questions/problems :
http://developer.android.com/guide/topics/ui/dialogs.html#CustomDialog
An Activity in general is better than a dialog, because u can take care of all things like orientation, theme etc. and it provides more flexibility. Though in simple cases u can use a dialog.