![Adding buttons on top of the default call screen of android][1]
http://i.stack.imgur.com/SJ8Pc.jpg
As shown in the below image, there are two buttons one is Live video button and the other is Picture share button, how to add those button on top of the default android call screen while making call.
Thanks,
Android F
I believe the way to do this is to draw views on top of the dialer activity. This is similar, in implementation, to the Facebook home chatHead feature. Have a look at this article, which shows how to draw any view: http://www.piwai.info/chatheads-basics/
In your case, your view would be a LinearLayout containing two buttons.
Related
I am currently trying to add a detail view feature for some elements of my app, and I am looking to display them like this dialog box in the Chrome app:
(It opens when you click on the https lock symbol)
The box should cover the entire top of the apps window and not leave space on top, right or left, just on the bottom of course. It also should be dismissable by clicking outside of it.
I was trying to do this for a while now but without success.
How can I achieve this?
You can achieve it in several ways.
First one
Create your own analogue of DialogFragment (don't extend existing one) with your view (which'll be placed in the top) and show it like this:
getSupportFragmentManager().beginTransaction()
.add(new MyDialogFragment(), android.R.id.content)
.commit();
android.R.id.content is like root view of your activity (setContentView() adds view on top of it).
Activity one
You can create Activity that will be transparent and 'll have this "card" on the top.
Third one
Just make Dialog appear at the top of screen. Like this.
No sure if this is what you need but have a look at this library.
https://github.com/Tapadoo/Alerter
I need the image button to be visible when the user opens another app, you know, i need it like the floating button that is visible to the user when the user opens any other app.
i have a switch button the controls if the image button is visible or not
Have a look at this question.
Essentially you need to use the SYSTEM_ALERT_WINDOW permission which allows you to draw over other apps, make a custom layout file which contains the button that you want to show and use the WindowManager to insert it into the view.
I wanted to take screen shots from the android screen with a floating button.
I made the floating button and it takes screen shots and everything works well but there are two questions
1. How can my app take screenshot in a way that the floating button gets hidden then appears after the screen shot has been taken in order not to bother the user
2. When you press the volume down and power key to take screenshot, it has a great animation. How can i add that animation?
Get your button's view, and just before taking the screenshot, hide it and unhide it after you are done taking the screenshot in the floating button's onClick method.
findViewById(R.id.floating_button).setVisibility(View.INVISIBLE);
// Take screenshot here
findViewById(R.id.floating_button).setVisibility(View.VISIBLE);
Add it in your java file
View b = findViewById(R.id.button);
b.setVisibility(View.GONE);
This is how the system does the animation. You should be able to re-use most of the code you find here:
http://androidxref.com/5.1.1_r6/xref/frameworks/base/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java#388
Animations:
http://androidxref.com/5.1.1_r6/xref/frameworks/base/packages/SystemUI/src/com/android/systemui/screenshot/GlobalScreenshot.java#540
I'm trying to make an extra effect to menu that will come down from the top of the screen
I want to make it enter the screen while swiping it from the top and if the user left it, it should continue to the end
this is the figure that demonstrate what I want to do:
I tried to do it with animation but the animation will not go on while swiping and it will go to the end without touching
any other ideas to move the view down with finger ?
Check this out for a sliding Drawer http://developer.android.com/reference/android/widget/SlidingDrawer.html
it sound like you kind of want the same thing as the pulldown menu at the top of all android phones except you want it customized, the link will show you that.
OK
It works for me now
I used SlidingTray.java class from this API
API Website
btw : this api open source
I want to create a button which will be shown on top of all apps.
something like this
as you can see, there is a button at top left corner. it can receive touch events and touch events can be received outside it by other apps.
I tried to use Theme.Translucent.NoTitleBar to my activity but it does not helped. I also set size to my button to [100, 100] but other activity behind it can not receive touch events. I think that the problem is in activity's window. it's size does not equel activity's size.
any help please
UPD
solved
hatcyl in Create a UI or a widget that sees on top of all Application in Android? says:
If you want something to be clickable, you can display it on top of
anything except the lockscreen.
You would to use a service and WindowManager to show a button on every App.