There is compound widget which consists of VideoView and Button. VideoView play video, Button handle events. I'm struggling how to make it resizable according to pinch gesture.
Unfortunately, it is not possible to add pinch zoom to widgets, since there is no way to add event listeners to widgets. The only way a widget can receive input is assigning on click intents to different components, which start activities. As for videos, look into the VideoView class, although AFAIK this doesn't work well (if at all) with widgets.
Related
I'm using this awesome library Dragger to add drag features to my activity, but is there a way to limit the width of the activity when it shows up or dragged..!? I don't want it to fill the entire screen..! kinda like the drawer navigation menu (see the pic below).
I was thinking of Dialog Activity, but it seems to be concerned with dialogs only and won't allow filling the other 3 sides or I not fully understand it..!
Any help?
Activity is not a view, so it does not have a size. Its' layout views do however.
You can try changing their sizes. Or, as it is an animation lib, you can try modifying existing or adding your own animations where views change sizes when moving. You can modify this param:
<item name="android:windowAnimationStyle">#null</item>
This might help you.
I develop a simple Android app, and I want to know how many fingers is touching the screen. It's simple with OnTouch event but this solution doesn't work if the user touch the keyboard software (for security and privacy issues)
I have tried to use a specific overlay like this : Creating a system overlay window
It work, the onTouch event is called everytime, everywhere, but the overlay block all the touch event and the app is unusable (touch button, write with the keyboard software, all interaction doesn't works)
How can I receive touch events on my overlay and on my others view behind this overlay ?
I am developing an application to be used in an Android TV environment. I am having a problem about how to implement this using the D-Pad navigation.
I want to achieve this effect.
But I am having problems like:
how could I resize the ImageView at run-time?
how to have a hovered-state ImageView?
how to move the hovered button according to your d-pad input?
Currently this is my what I have done.
I implemented this using horizontal linear layout and ImageViews.
Thank you
I have a simple soundboard which uses Buttons to represent the sounds. When a sound button is clicked. The background image is changed using the view.
Button butt = (Button)view;
butt.setBackgroundResource(buttons_on[media]);
buttons_on is a int[] representing the drawables of the buttons.
This all works perfect, but I also use a FragmentActivity to create a paged App. The App has 4 different pages which you can swipe through. When I change a button using the above code and swipe two pages to the right and than swipe back. The image of the button has changed back to it's default defined in the page.xml.
How can I prevent this behavior?
change the Buttons to ImageButtons and setting the src?
somehow prevent the page from reloading
Instead of doing that you should look at how to use a StateListDrawable. It will simplify your approach.
I'm using a LinearLayout (with some views inside) for representing the sound On/Off button in the Settings screen.
When I set the OnClickListener to this Layout it automatically plays the system "onClick" sound when clicked.
I'd like to play the sound only when the sound is going from 'NoSound' to 'Sound'. How can I supress the sound in the other case?
Have you tried using setSoundEffectsEnabled(false/true); which should work as per documentation that
Boolean that controls whether a view should have sound effects enabled
for events such as clicking and touching.