2016-02-20 48 views
0

這是由sinch在Android Studio中編寫的。 我有2個視圖在其中。我想讓頂級視頻變得透明,所以下面的視頻也可以看到。我試圖改變阿爾法,但沒有奏效。代碼如下:如何使視頻半透明,而不是背景,但實際的視頻(內容)

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; 
+0

您是否嘗試過更改'vc'的'alpha'或者甚至整個'RelativeLayout' – drWisdom

回答

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; 

但是,我不知道,如果你正在使用你想支持的功能庫。