How to create a floating view over another view in android - java

I don't know exaclty how it is called, but I got a screenshot:
Basically, in this case, I press a button and this window from "FC Barcelona" pops up, occupying about 3/4 of the screen. After it is opened I can drag it up and down. If I drag it up, it occupies the whole screen, if I drag it down, it disappear.
How can I use this tool or how it is called in android?

What you want is a BottomSheet. You can find an example on how to do it there at the Design Support Library: Bottom Sheets section.
http://android-developers.blogspot.de/2016/02/android-support-library-232.html

Related

Draggable overlay that can go offscreen?

I have created an overlay menu that is a rectangle.
It displays on top of everything else while active. All other apps, the home screen, etc.
If you click anywhere outside of this rectangle your click hits
whatever is visible.
If you click the red part it allows you to drag the menu around the
screen. Clicking the green part performs some function.
I have created this rectangle from inflating layout xml. The rectangle itself is a relativeLayout and the green and red parts are both imageView children.
Since I'm unable to move the relativeView off screen and since the background needs to be clickable my only solution was to calculate margins and apply them to the relative view to imitate the desired effect.
However, the code to calculate these margins is almost 50 lines and fairly complex and hard to understand at a glance if someone else needs to refactor. I can post the code but I don't believe it's relevant to the actual problem's context.
Is there a much simpler way to do this that I'm missing? Is my approach wrong?
I hope this simple project may help you Android Floating Widget

How to keep popup on one screen in Intellij IDEA?

When I type dot and press ctrl+space, I see a pop-up with list of possible methods.
when I press ctrl+q i see another pop-up with javadoc for the selected method.
The problem is half of the popup is on the one screen and second half is on another screen. it's unreadable. how to make the pop-up stay on one screen?
ubuntu 14.04, mate, 2 monitors (extended desktop), intellij 2016.1.1
The pin is your friend!
Press that pin in the top right corner to "Open as tool window"!
From that moment on, the documentation will always appear in that specific window. Just resize it and place it somewhere in your screen where it does not interfere with other things. From that moment on, every time you press Ctrl + Q the documentation will appear in that window.
Also, note you can change the font size:
But it may be more handy to drag the popup with the mouse:

Draggable border to resize view

The past few months I've been on a mission to implement widget support in my home screen replacement for Android, and it's proving rather difficult. I can now add and remove widgets to/from the home screen, but they can't be resized or moved yet. Currently what I'm trying to achieve is to resize them. To do this I have every widget embedded in a View, over which I put an overlay to make sure the touch events don't get caught by the widget underneath it (which caused trouble in past attempts).
What I have now is this layout for the container; http://www.hastebin.com/uwocaxukel.xml
The widget is put in the FrameLayout with id widgetContainer. As you can see in the screenshot below there is an orange dot in the middle of every border.
Now what I've always tried to do so far is catch touch events, figure out whether the user is trying to drag one of the borders (MotionEvent.ACTION_MOVE), and if he is, change the required properties in the LayoutParams object and call this.requestLayout () on the view. This is finicky, and less than ideal. Very often the touch events would stop registering because the user dragged faster than the view could refresh = user is no longer on the view which is listening for touch events, or the border would be too thin to hit.
So far it's all been very finicky. But there are other apps which seem to do this pretty much perfectly. Is there a library, a class I've overlooked, or something else I can use to achieve my goal?
This is an example of something that kind of worked, but was very finicky and just not remotely user-friendly; https://github.com/RobinJ1995/be.robinj.ubuntu/blob/869d48af2e7a3d8f0332f84edd2a8cd28564424a/UbuntuLauncher/app/src/main/java/be/robinj/ubuntu/widgets/WidgetHostView.java#L75

Java SWT: Show Zoombox around cursor

I need your help with my application.
I'm writing a program that displays big images in tiles, using the SWT MapWidget (http://mappanel.sourceforge.net/swt/).
The user has the ability to place markers on the map, when he pressed the mouse for a couple seconds. Additionally, I also need a little ZoomBox next to the cursor that shows the area around the cursor, so that the user has better precision when placing a marker. This ZoomBox is to be displayed while the user keeps the mouse pressed. Placing the markers ia already working fine.
I have problems with implementing the ZoomBox, specifically displaying it. I found a post that does just what I need (Zoom box for area around mouse location on screen). The problem is, this post is for Swing and not for SWT.
I have already built a SWT_AWT-Bridge, so I have the ZoomPanel already in my shell. What I need is the functionality of displaying it on top of the MapWidget, while the user keeps the mouse pressed.
I figured, I need to use a StackLayout, but I don't know how.
EDIT
To clarify, my question is, how can I display the composite containing my ZoomBox on top of my image, while the user keeps the mouse pressed?

Layout for touch screen application

I have to develop a touch screen application based on swing for the GUI part.
The application will have to be displayed on different screen, one 15" 4/3 screen and one 20".
What kind of layout stategy should i go for, to keep the same proportion in my components from one screen to another ?
The application will have a kind of status bar at the top displaying some information coming from a server, a menu bar at the bottom, the main central part of the application will display graphs, and on the right an area that will display the same information as the graphs, but in digital format. Buttons from the menu bar and labels in display/status bar have to be quite big as the users that will play with the screen may wear gloves...
Thanks you for help.
any specific layout manager is not gonna do the trick....Handling the window size is not a problem as that can be taken care of (use ToolKit for that). Only problem is that u gotta make sure that, the component sizes are not fixed, cos when screen size changes that gotta change as well. This is a peculiar problem, lot of trail and testing may be required.

Categories