问题
How to get the pause play forward button option to center of the screen in MediaPlayer but by default it shows at the bottom of the screen.
Here I am using videoView in fullscreen
XML:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
<VideoView
android:id="@+id/media_video_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:layout_alignParentEnd="true"
/>
</RelativeLayout>
below i had updated my answer which i had tried and got solution for this please have look at it.
回答1:
You can use custom MediaController
or set it position by
mediaController.setPadding(0, 0, 0, px);
Refer this
You can also use setAnchorView
which will reposition controller below particular anchor view, but in your case that won't be possible.
Hope this helps.
回答2:
we can get key options any where in the fullscreen in videoview by below:
DisplayMetrics metrics = getApplicationContext().getResources().getDisplayMetrics();
int screenWidthPx = (metrics.widthPixels);
int screenHeightPx = (metrics.heightPixels);
MediaController mediaController = new MediaController(Activity.this);
mediaController.setPadding(0, 0, 0, screenHeightPx );
screenHeightPx : you can adjust it where ever you want in the screen.
Hope this helps.
来源:https://stackoverflow.com/questions/27099882/how-to-get-hardware-key-option-to-center-of-screen