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.
Related
I checked android docs, but didn't really find an answer on how to show custom layout in my application. I'm thinking of custom fragment placed next to navigation drawer. Maybe someone can give me pseudo code for better understanding? Thanks.
Visual representation:
http://imgur.com/a/VwTvs
On specific itemClick I want to make a layout (that contains icons/pictures) and place it next to nav drawer.
The key-word you are searching for is resource buckets. Essentially you can create resource-folders based on screen size, API version, orientation and such. Refer to the official documentation on how to create layouts for different screen sizes.
In Android Studio you can create resource-files based on those quantifiers by open the "new resource file" dialog and selecting the quantifiers you want in the lower part of the dialog.
Have a look here to read on layouts made exclusively for TVs.
I've got an preference screen with android:dialogLayout="#layout/my_own_layout"
I would like to make my own dialogLayout look almost exactly like the default one, only with some minor changes (adjusting the spaces between title and summary).
Is there any way I can get the default layout? With the text sizes, paddings and so on?
Any help is appreciated.
You can always check the default layouts in different platforms and you can modify them.
For instance you can access the alert dialog layout in the following path:
android-sdk\platforms\android-15\data\res\layout\
for Android API LvL 15.
You can search for other api levels anytime to check different layouts there.
How can I create a floating window in Android Honeycomb like the one of Calculator or notepad application?
I've tested with
android:theme="#android:style/Theme.Dialog"
and I get a centered transparent activity but the problem is that it isn't movable and hasn't close button.
That calculator you show isn't a part of Android. Also, Android windows don't have close buttons like that. I don't know what you are looking at, but it isn't standard Android in any way shape or form.
AirCalc can do it https://play.google.com/store/apps/details?id=com.myboyfriendisageek.aircalc&hl=en
--Edit
Just to add to my previous answer. It doesn't need to be Custom API provided by device manufacturer as #hackbod mentioned in the above answer.
You can actually write a Service and Add a Layout to the WindowManager and set it to be TYPE_SYSTEM_OVERLAY and there you go, your application is running on top of other applications.
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.
Does anybody know how you create the that big scrollbar which is used in the contact list? Or the one down there in the screen shot:
Set android:fastScroll="true" on your listview, or anything scrollable by all accounts. You can also set this in your theme or settings.xml files.
My bad,
android:fastScrollEnabled
As per the comment below.
On api target >= 11 you should also use
list.setFastScrollAlwaysVisible(true). Otherwise it may not show up. –
Igor Ganapolsky
if you want scroll bar only for a Activity then use
android:theme="#android:style/Theme.Holo"
only for that activity, you can also use this for whole application.
Try this:
android:fastScrollEnabled