如何获得硬件密钥选项,以屏幕中心 [英] How to get hardware key option to center of screen

查看:206
本文介绍了如何获得硬件密钥选项,以屏幕中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何让暂停播放快进按钮选项中的MediaPlayer屏幕的中心,但在默认情况下它显示在屏幕的底部。

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.

在这里,我正在使用全屏videoView

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.

推荐答案

我们可以在那里通过下面videoview全屏得到密钥选项的:

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 :您可以调整它在任何你在屏幕想要

screenHeightPx : you can adjust it where ever you want in the screen.

希望这有助于。

这篇关于如何获得硬件密钥选项,以屏幕中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆