Drag views in android - java

I want to create a Draggable activity/fragment like the default settings screen in abdroid which opens when I pull down from HOme screen. By draggable i mean I want to pull the screen down from a point to close it.
I am trying to figure out the term used for this. I went through Drag views but that is used for moving view around the screen. Has someone solved this? Please help!

Android does not provide any API to support development of the settings-like screen. If you have to implement it, you will have to do that by yourself.
In order to fake the settings-like pull down screen within your application, you will need to create similar UI layout and use it in combination with the swipe down gesture (which works only when you swipe from the top within your application) and Animation.

Good place to start is to look on
DrawerLayout
It for drag layout into the screen and out.
A pretty good library that handle the stuff for you is:
AndroidSlidingUpPanel

Related

Want to implement tabs in android?

I am trying to implement swipe tabs in my application but don't know what is the best way to do it.I am confused as to whether I should action bar navigation bars or some other mechanism.
I want my application to have Scroll-able views like in the link below?
https://play.google.com/store/apps/details?id=com.asus.todolist
You can use uiautomatorviewer to determine what that app is using. My guess is that it is using a ViewPager with a PagerTabStrip for the tabs.

How do you put tabs under another layout similar to the Google+ app? (Example Pic Incuded)

I want to implement something simlar to this Google+ layout. The page scrolls until the tabs at the bottom hit the top. Then the list view in the tabs scroll. Does anyone have an idea to do that? (The tabs should still be visible but the content inside scrolls.)
Please don't hesitate to ask for clarification.
Any help is appreciated. Thanks.
If you were to use uiautomatorviewer to examine that app, I suspect that you will find that the tabs are a tabbed indicator for a ViewPager. PagerTabStrip is one that ships with the Android Support package, the ViewPagerIndicator library has another, and there are still more floating around out there. Such a tab strip can be placed pretty much anywhere.

Android Menu Layout Front page

I want to make a menu sort of similar to Yelps front page.
The left image in particular. I feel like I've seen this on multiple apps, and I also remember thinking that this was actually something built into the default android layouts, but I can't seem to find anything on it anywhere.
How would I go about making this layout? Is there something already built for you, or do I have to make using image buttons and a relative layout?
Google+ also uses something like this on their first page; a lot of apps do now. It's called a dashboard layout. You can see an overview of that here and an explanation of how to create it here.
Using button images and a relative layout is an easy way to do this. For help on that look at this tut: http://developer.android.com/resources/tutorials/views/hello-relativelayout.html

How to make overlay for video in swing

I want to make a transparent overlay for a foreign project to show live video. Sample of overlay is given in the image link below. In image you can see a overlay at right bottom corner showing face of a person, I also want to achieve same functionality using JMF to show face and then display the face in overlay using swing.
Sample Overley Imahe: http://www.ovostudios.com/images/vidsamsolo.jpg
Can someone help achieving this functionality?
If you're just starting the project and haven't actually got the JMF part up and running yet, then you might want to take a look at some alternatives before committing to it.
If you want to go ahead with Swing, to get the general overlay behaviour you want, you'll need to make use of Frame.setUndecorated() to turn off window borders and buttons, and Window.setAlwaysOnTop() to make sure the window stays on top of other windows. For the transparency, see this tutorial. However, I'm not sure whether transparency and video will work nicely together, so good luck!
You might also want to write a custom focus handler for the window so that it cannot be focused, although it is probably impossible for the overlay to be properly 'phantom' whereby clicks just pass through the overlay to the underlying desktop. That kind of behaviour might only be possible by using low-level graphics techniques i.e. by not creating a window at all, but by drawing directly onto the screen. That might require a native library.

how to create a drop down menu java app on the desktop to hold desktop icons (java)

I'm trying to create a java desktop application that holds desktop icons. The app will be a menu/panel that is invisible until you hover your cursor near the top of the screen, at which point the menu full of desktop icons will drop down. To add new icons to the menu one must simply drag icons from the desktop into the menu and they should snap to grid. As I am an intermediate level programmer but I havn't ever done a GUI app before in any language, I was wondering if someone could help me out, both with how to approach the problem and on the packages and methods I should be using. Also, I'm thinking of doing this with NetBeans unless you have any other suggestions.
Thanks,
Andrew
As an alternative to Chad's option, you could also do this by creating a frame and using Java's transparent window capability to make the frame transparent (or translucent, if you want a hint that it's there), and using mouse entered/exited events to return the frame to its normal "solid" opacity.
Personally I'd try this solution just because I'd rather use event-based notification than polling the mouse position, but I expect it's more work than the other alternative.
As to drag and drop, I haven't used it extensively enough in Java to give any solutions, but it's not immediately obvious (from a cursory internet search) of how to handle native desktop drag and drops. I'd suggest starting with some dnd tutorials within an application so that you really understand Java's drag and drop API and capabilities.
You can use java.awt.MouseInfo to get the location of the mouse at any point in time, even if you don't have any windows open.
So, you could start a java program, then in your main loop poll the mouse location. If it's in the 'top', then you can open a window.
You can use the easiest thing to do would be to use JButtons or JLabels with images to represent the desktop icons. Just load the image you want to use and stick that on as a label.
I'd start by going through swing tutorial and writing a few simple GUI programs to get the hang of it.
But the MouseInfo thing is what you need to tell when the mouse is at the top of the screen.

Categories

Resources