I create an app which need to disable all buttons to allow user to leave the application - back button, menu button, camera button, call button, etc, and app should have 1 button for exit. I don't know how to disable all buttons. Tell me please, thank you
The Physical buttons? No, you can't disable all of them. Home button needs to work... Android - Is It possible to disable the click of home button
Related: Android: mass enable/disable buttons
Try this: when you enter the activity, call
getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
and when you exit the activity, call
getWindow().setType(WindowManager.LayoutParams.TYPE_APPLICATION);
Related
I am currently working on a calculator application which has a scaleable NumPad with a lot of buttons:
The Buttons on the NumPad should register user input when they are clicked. Additionally, if the user performs a zoom-gesture on the NumPad it should increase in size / decrease in size.
What's my Problem?
I want to handle onClick events if the user taps a button, but also handle a gesture if the user pinch-zooms on the buttons. How can I do that?
GitHub Repo: https://github.com/Max-We/TheCalculator
Hi #FxMx you can have a look at this - Pinch Zoom and onClickListener for same layout not working in Android
You can set a ontouchlistener on your NumPad layout and do nothing if its single touch and you can set onClick listeners to your NumPad buttons which can perform your register events.
I currently require to design a camera function for android version 4 (Kitkat), but i notice that there is snap picture button and ok button in the camera as picture below:
How to make it disappear and user just touch on screen it can snap the picture without the button, and the picture will directly save without need of pressing ok button.
Anyone can share me the ideas, I very need you guys help because suffer this for long time already, thanks.
I have a Floating Action Button with a custom menu of mini Floating Action Buttons, that appears upon click on the main Floating Action Button.
The mini FABs are in a LinearLayout.
I want that after opening the FAB menu, when the user clicks elsewhere, the menu disappears. However, I haven't been able to find how to do this.
What listener do I need for this?
Any help?
Thanks.
You are most likely interested in a custom FloatingActionButton.Behavior:
https://developer.android.com/reference/android/support/design/widget/FloatingActionButton.Behavior.html
https://medium.com/#nullthemall/floatingactionmenu-floatingactionbutton-behavior-dd33cc0d9ba7#.jsvuvz2rk
Otherwise you can simply set the Visibility of the respective controls to Gone based on a OnTouchListener that checks if you are touching outside the FAB.
i have a project that is calculator, there is many button and layout above the main layout, i have a history frame that hidden at the right screen, i want that if i swipe the edge of the whole screen and ignore the button and other objects there, the history frame shown
i already read the question here
how to fire an event when someone clicks anywhere on the screen in an android app?
but it didnt work for me
thanks
I solved this problem using dispatchTouchEvent.
In my application (only for my application), I want to add a button to the navigation system bar
How I can do that in my code?
You cannot do anything there. Not to mention some devices will not show this bar at all if they got hardware buttons.
You can't.
Maybe try to add a fragment that will be exactly above it.
Some phones don't even have that buttons on screen.
firstly check mobile or tab has soft buttons if has then make full screen by programaticaly after that create custum button bar like tab bar at bottom and put buttons as you like thats better if u dont have any other idea
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);