如何使视频半透明,而不是背景而是实际的视频(内容)

时间:2016-02-20 17:23:00

标签: java android

这是由Sinch在Android Studio中编写的。 我有2个视频,其中包含视频。我想让顶级视频半透明,所以下面的视频也可以看到。我尝试更改alpha但无法正常工作。代码如下:

private void addVideoViews() {
        if (mVideoViewsAdded || getSinchServiceInterface() == null) {
            return; //early
    }

    final VideoController vc = getSinchServiceInterface().getVideoController();
    if (vc != null) {
        RelativeLayout localView = (RelativeLayout) findViewById(R.id.localVideo);
        localView.addView(vc.getLocalView());
        localView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                vc.toggleCaptureDevicePosition();
            }
        });

        LinearLayout view = (LinearLayout) findViewById(R.id.remoteVideo);
        view.addView(vc.getRemoteView());
        mVideoViewsAdded = true;

1 个答案:

答案 0 :(得分:0)

试试这个:

   final VideoController vc = getSinchServiceInterface().getVideoController();
   if (vc != null) {
     RelativeLayout localView = (RelativeLayout) findViewById(R.id.localVideo);
     View lView = vc.getLocalView();
     lView.getBackground().setAlpha(128);
     localView.addView(lView);
     localView.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            vc.toggleCaptureDevicePosition();
        }
    });

    LinearLayout view = (LinearLayout) findViewById(R.id.remoteVideo);
    View rView = vc.getRemoteView();
    rView.getBackground().setAlpha(128);
    view.addView(rView);
    mVideoViewsAdded = true;

但是,我不确定您使用的库是否支持您想要的功能。