Member-only story

Android: How to make a circular view as a thumbnail of OpenTok?

I have a requirement as the image below.

Nhan Cao
3 min readJul 6, 2019

Because OpenTok using GLSurfaceView for a renderer, and with multi GLSurfaceView on screen, we must use .setZOrderOnTop(true); for all thumbnail function. That is the problem.

I tried with a circle drawable XML place at parent view as background, it does not work.

<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval">

<solid
android:color="#666666"/>

<size
android:width="120dp"
android:height="120dp"/>
</shape>

I tried with customizing ViewGroup such as FrameLayout and it does not work also.

public class CircleFrameLayout extends FrameLayout {
private Path clippingPath;
public CircleFrameLayout(Context context) {
this(context, null, 0, 0);
}
public CircleFrameLayout(Context context, AttributeSet attrs) {
this(context, attrs, 0, 0);
}

public CircleFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, 0);
}
public CircleFrameLayout(Context context, AttributeSet attrs, int…

--

--

No responses yet