Hi, I created an application to watch a video in its working condition. but the size of my video image changed automatically depending on the height and width of the video, but I want to play the video as a video viewer, how to solve this problem.
This is my code:
public class MainActivity extends Activity { String SrcPath = "/sdcard/maatraan.3gp"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); VideoView myVideoView = (VideoView)findViewById(R.id.myvideoview); myVideoView.setVideoURI(Uri.parse(SrcPath)); myVideoView.setMediaController(new MediaController(this)); myVideoView.requestFocus(); myVideoView.start(); } }
xml code:
<VideoView android:id="@+id/myvideoview" android:layout_width="400dp" android:layout_height="400dp" /> </LinearLayout>
I determine the value for the height and width of the video image manually, if I play the video in this height and width, I automatically change this height and width to the height and width of the video. I do not need to change the size of the video image, I need to change the size of the video, then the size of the video image height and width of the screen, which is all ....
source share