I want to show an activity in dialog as shown in the picture below. Does any one know how can to achieve this result?
I tried using this code for that activity but it didn't help me.
android:theme="#android:style/Theme.Dialog"
It shows in middle of screen can I change its position ?
Instead of creating a new Activity with Theme.Dialog, I would suggest you to use Custom View to appear on that action and later hide it.
There are open source custom Views called as QuickAction.
Please have a look at this post.
And specially this git repo, pointed in the post linked in the accepted answer.
Related
I have a button which on clicking opens another activity which comes up from below and covers half the screen. I searched about it but did not get any useful approach except the overridePendingTransition function which is useful in getting the animation on activity transition, but this didn't solve my problem. I know this is done in google hangout as shown in the images but can't find any useful solution.
When we press the button this activity comes up and covers half the screen size
when we scroll up the activity becomes our main activity
Any idea how this can be done?
Thanks
you can use bottom sheet for this type of UI.
here is first sample.
another sample
here is code
After some searching i got exactly what i wanted with all the codes, but still the profile picture animation is remaining, rest the SlidingPanelLayout code can be seen here . It contains some detailed information with all the classes implemented which you can use directly. I think this will surely help you. :D
Edit: As said by #MrsEd i would like to add some code that helped me. This is the custom built DraggableLayout which you can use directly, the code can be found here. Then the activity must implement the onStopVerticalDragDown() of the DraggableLayoutCallbackListener inteface and set the content view as this xml file.
Hope this clears all the doubt and makes it easier for anyone to implement their own custom built DraggableLayout without using any third party library. :D
Please. Don't redo this.
And instead, use Flipboard's BottomSheet.
I am trying to make similar layout to this one.
I achieved everything except that pop up window (saying "Perfect"). How to make this? Will pop up windows? Dialog or somehow else?
The screenshoted layout look like a WebView to me. Thus you could try to take all advantage of the WebView to create any html-based layout.
The pop-up could also be a custom dialog, or just a div on top the main layout or whatever. For example, check this.
There are 2 ways you can approach this.
If you want a view above another one you can use FramLayout. Tutorial here.
If you want it to be a dialog you can follow this tutorial Tutorial here
I want to add an dialog to my application. I want it to launch as soon as the first activity loads. But instead of having just a single message to display and having a 'yes' and 'no' button like this
I want it to display a list of message like this
If there is a tutorial that speaks on this subject I would be happy to look at it and also I would anybody by any chance know how to align these list with bulletins.
1 Create a custom dialog layout (XML file).
2 Attach the layout to Dialog.
3 Display the Dialog.
4 Done.
Tutorial here
If there is a tutorial that speaks on this subject I would be happy to look at it
Your best bet would be to start Here in the Docs. They show a great example of doing it with a Dialog.
Another option, if this can be the entire Activity since you want it to happen when if first starts, is to use a ListView for your Activity and use setChoiceMode() on it. You can find more about that in the Docs
With this second option, you can make the Activity appear as a Dialog by adding this line to your <activity> tag in the manifest.xml
android:theme="#android:style/Theme.Dialog"
I need your help, cause I'm thinking about how to resolve this problem and don't know what's the best method:
What I have:
I have a standard ImageGallery. Below this, there is a Button.
What I want:
When I press this Button, there shall be opened a List of all the images, consisting of a small image on the left and a short description in one row, all the content should be brought by an array in an extra folder.
By clicking one row, the chosen image should appear in the Gallery and the list should be closed.
What I am thinking:
is, that I have to create a custom Dialog (Alert Dialog?Binder?), started by the Button. This Dialog must be filled with a custom ListView.
What I don't know:
What components of the framework do I need for this? I have found some things with Google, but at least I'm not sure what's the most efficient way.
I saw, that somebody had created an extra activity for the Dialog, using a DialogLayout.
Someone else tried it with a builder, another one with an AlertDialog.
Furthermore, I'm confused about the combining of the ListView, ArrayAdapter, Dialog, ViewBinder, getView, Objects and so on.
Someone has an idea how to resolve this on the easiest way?
You need to do something like this:
Define an activity extending ListActivity.You can refer this tutorial how to use listactivity.
Add this activity in your manifest file with theme attribute android:theme="#android:style/Theme.Dialog" in your activity tag which will make your activity look like a dialog.
You can start this activity on your button click.
If you want some result should be returned to your calling activity then use startActivityForResult().
After seeing the last screenshots of new foursquare application and their balloon like cartoon instructions, I'd like to create some of these in my application.
I found a similar question for iPhone
Small popup for instructions... How?
Here is another screenshot of foursquare app:
I'd like to know how I could achieve that with Android.
Thanks in advance for any help.
UPDATE: This is what I could get so far but adding some buttons with a custom drawn background and layering them with a FrameLayout:
But I still couldn't get the triangle effect. Maybe there is something I can do with my custom background shape?
UPDATE2
After checking your suggestions, I decided to go with Aaron C idea and added an image with an arrow on it. This is my current result:
Thank you Snailer, QuickAction API project seems very much promissing. I'll check it out when implementing more features in my app.
Now, I just need to get the right color or maybe I could just let it this way. It seems nice too.
And, so, to summarize what I did:
Got my initial xml layout inside a FrameView.
As I'm using a frameview, everything I put in here will be piled one over the other. That's how I could add things to the layout.
In that framelayout, I put 2 relativelayouts whith an image with the triangle and a button to create the two upper popups. In the bottom I put a button only.
That's it. I hope it helps somebody.
Thank you very much again for all your help!
That sounds like a neat thing to implement. There might be a built-in Android variation on AlertDialog that achieves this, but if not here is how I would go about implementing it:
Create a new Activity whose background is black with a very high (low?) alpha color value. This will allow you to see through it to the previous Activity in the stack. Then, add your alert at whatever coordinates you like using a relative layout with padding values.
You might also want to add a touch listener that exits the Activity if the user touches the balloon (or maybe anywhere in the screen).
If you want to be fancy with coordinate placement of the balloon, you can pass this information into the new Activity using the Activity's launch Intent with the putExtra() methods.
It's probably achieved through skinning a toast.
The developer documentation shows a skinned toast in "Creating a custom toast view" at http://developer.android.com/guide/topics/ui/notifiers/toasts.html
You may want to look at the QuickAction API. It acheives this by using PopupWindow, skinned, positioned, and animated.