Hmm, looking at the way android popup it's text for the license with scroll, anyway to replicate it? Screen as below
For creating this pop up you need to do like this.
1) create an activity as like your displaying popup
2) add below section to the manifest file
<activity android:name=".popupActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Dialog">//====> this makes the activity to display like pop up when call make to this activity
when you call this activity through intent its look like what you require..
Please use custom Dialogue box and add some scrollview and linear layout into it. Then put your actual text into it.
You can use this android popup library with your custom layout. Very simple to use with one line of code in your activity.
Pop.on(this).with()
.title(R.string.title) //you can skip if you don't need title
.layout(R.layout.license).show();
Related
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'm developing an app that includes reviews of items and due to my design, I want to only show all the reviews in a popup window like in Google Play Store:
What should I use to create that white panel that appears over the current window and contains the necessary information? This should be simple but I'm a newbie and I can't seem to figure out what this "widget" is. Please help me if you are familiar with this so I can use this cool design pattern. Thanks.
It seems you want to display a layout as a popup in another activity.
If you want to do this using an Activity instead of a Dialog, you can do this by setting the activity's theme to android:theme="#android:style/Theme.Dialog" in the manifest - this will make the activity appear like a dialog (floating on top of whatever was underneath it).
A better way to do it would be using a DialogFragment. You can display information in the form of a popup and it will have its own lifecycle. That will be much better than displaying an activity like a dialog
Ram kiran's answer is a good one and one which I like to give also. But just so you have another option to look at you can consider PopupWindow
As stated in the docs, it is
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.
I've used this and it works out nicely in some situations. It really depends on what your exact needs are as to which will work best for you.
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.
I have just finished my first app in Android and now I want to build a small instructions page that will open when the application opens. Id like the user to be able to read a small set instructions and then just click a close button on the same screen to close the screen and begin using the application.
Should I do the with an alert box or is there a better way?
Thanks for the help.
I would use an Activity with the style set as Theme.Dialog you do this in the AndroidManifest.xml as follows...
<activity
android:name=".InstructionsActivity"
android:label="#string/app_name"
android:theme="#android:style/Theme.Dialog">
...
</activity>
Use SharedPreferences to save a 'first run' boolean and check it in the onCreate(...) method of your MAIN/LAUNCHER Activity - if the boolean is true then set it to false then use startActivity(...) to start your InstructionsActivity dialog.
I would create a small activity with a TextView of your instructional information in a ScrollView with an anchored Close button at the bottom of the page.
Consider a layout similar to the Android first-setup layout:
You would use a centered Close button instead of a next button, but the idea would be the same. This is a very clean layout for longer messages in an application.
The AlertDialog is good for this however longer content may be better with a mobile optimized web page and don't forget to make the help available from other parts of the application.
All,
1.) I have a Dialog showing on my application. Right now it is showing in the center of the device. But i want to see that dialog in Top of layout. How to move it?
2.) How to add an image in a Dialog box?
EDIT: I added an image in background of Button. I want to move this button into right corner of Pop up Dialog. How to do that? And also i want to know how to move the entire Pop up Dialog itself into Top of the Layout screen?
As i'm new to this development, please some one suggest me how do i achieve this?
EDIT:
CAN SOME ONE TELL ME HOW TO MAKE THREE CONTROLS IN A SINGLE LINE USING LAYOUT? I WANT TO SHOW AN IMABE, A BUTTON AND TEXT LABEL IN A SINGLE LINE. I TRIED THAT ON LAYOUT IN ECLIPSE. BUT IT ACCEPTS ONLY ONE CONTROL FOR ONE LINE, IF ADD NEXT CONTROL IT GOES TO NEXT LINE(ROW). I WANT TO MAKE THREE CONTROLS TO BE IN SINGLE LINE. HOW DO I ACHIEVE THIS?
After creating the dialog you can call dialog.getWindow().setGravity(Gravity.TOP)
If u want to change height and width
dialog.getWindow().getAttributes().... This will return WindowManager.LayoutParams
you can set ur values and use setAttributes() function
I am not aware of an API to change the position of a dialog. You may be better served creating an activity and using android:theme="#android:style/Theme.Dialog" to make it look like a dialog.
If you go that route, you will then be able to use all of the standard techniques for placing widgets (e.g., images) wherever you like.