Program: android studio
hello
I'm trying to create a button that when I press on it, a full screen video show up. But the problem is when I set a VideoView it shows a gray screen on top of my play button.
What I want, is to make the VideoView invisible and completely white and use the button to play a full screen video without having any gray box covering my screen.
Call
videoView.setZOrderOnTop(false);
before playing the video, and
videoView.setZOrderOnTop(true);
after .start()
Alternatively you can use
videoView.setBackgroundColor(Color.TRANSPARENT)
Whichever one is applicable
Related
Suppose I'm having a screen in which there are many buttons and textViews and if someone who comes through this screen while using the application tries to take a Screenshot or Screen Record, some views shouldn't be captured. Is there anyway I can do this?
Use file observer with the path to screen shot directory here is a good tutorial
https://theengineerscafe.com/create-fileobserver-android/
I have a certain problem: I have created a quick clicker game, where two players try to click quicker than the other one. A special button freezes the opponent's main button. The frozen button currently only becomes unclickable and its text color becomes gray.
To add some "style", I would like to literally freeze it. I don't really know how it would look like, but I thought about a light blue background, and some light blue spikes around it or something like that. I haven't found any style that would do that, and any image to replace the button with, because "Frozen" finds other images ;)...
I'm not a designer so telling me that tools that can design buttons exist won't help me.
Also, just an image won't probably be enough, because the button can be frozen at any moment, with any text and any text color.
Thanks for your help.
You can create button look (drawable) and set it programmatically.
Example
myButton = (Button) findViewById(R.id.myButton);
myButton.setBackgroundResource(R.drawable.frozenDrawable);
To do some simple looks for buttons i recommend you
Android Button Maker
.
Example 2
For more advanced look you can create some png
ImageButton myButton = (ImageButton)findViewById(R.id.myButton);
myButton.setImageResource(R.drawable.frozenResource);
I don't have code, but here is what I would experiment with, if I had to create create the appearance of a frozen button while keeping its text and general appearance:
To ice the button:
Using Google Image search, find the image of a slab of ice
Create an imageView with that "slab of ice" image as the src, and make it about the same size as your button (or slightly larger if you want the ice to leak out)
Place that icy imageView directly over your button.
Make that imageView slightly transparent by setting the "alpha" property to 0.5 (or whatever looks good, keeping in mind that 0 = invisible and 1=fully visible).
To unfreeze the button:
Make the imageView invisible.
Re-enable the button
I want to develop video player like dailymotion app. The main thing that i want to achieve is it's rotation behaviour and full screen button action. When user rotate device or tap on full screen button the video player goes to full screen and video play continue without any intruption.
Currently i am using video view widget for Stream video. but when user rotate device. the video stop and video view activity reload and video view intilize again and then video play.
So please suggest me solution of this problem. Thanks in advance.
You can use below flags when registering your activity in manifest file
android:configChanges="orientation|screenSize|keyboardHidden"
and then in you activty class just override "onConfigurationsChanged()" method so that your activity won't restart when orientation changes.
One thing that you can try is to save video current position in "onConfigurationChanged()" so that after rotation when VideoView reinitialize itself you can continue to play video from that position.
ues ExoPlayer as base class and extend it as your own Custom Player. these issues are handled here. this is available on official android developer site
http://developer.android.com/guide/topics/media/exoplayer.html
After getting solution to call my splash activity only one time (Part1 Question), Now i have to set up my splash activity.
On My First Layout i want functionality like this :
Image One <--> Image Two <--> Imgage Three --> Second xml(Activity)
Also on every image their will be a page control that will indicate on which image is currently on layout(Like the attached screenshot)/ or can be any other way to show this.
That Means From Image one i can go to image two on scrolling to right(I can come back to image one on scrolling to left) From Image two i can go to Image Three on scrolling right(I can come back to image 2 from Image three if i scroll to left)But if i scroll to right from Third Image then i should get to my Second Activity and never return back on those images.
i.e
I want to have scroll view having those three images with the page controller then after we scroll down to the third/last image on further scrolling to right i want that my second activity should be loaded and the splash should never come up.
Can any one tell me any idea how this can be done.
To make splash sheet with scroll view and page control & switch to second activity when done scrolling.
I don't want animation i want it to work manually like scrolling/ or any other way to implement this.
Coding will be much appreciated.
To implement scrollable images like shown above use ViewPagerIndicator library given HERE. Its simple to integrate and will take few minutes. All you have to do is read the usage section in given link.
For switching activity on last page, simply implement onPageChangeListener described in link and check for page number.
I'am using this player as a base for the project:
http://www.androidhive.info/2012/03/android-building-audio-player-tutorial/
I addition to that when I wanted to show different Images (kind of a slideshow) while playing the Audiofile.
Each image has a starttime and duration value.
I've archieved to play this slideshow of images, but with the problem, that I can't stop or pause it.
My Goal is an ImageView where I can controll the shown Image over the seekbar and the Play and Pause function, so that every Image will be shown at the right time while scrolling through the seekbar. (Same like the Audio file gets controlled kind of)
Right know I'm kind of stuck and need some approach to continue my work.
Anybody an idea how to solve this?