현재는 화면을 세로고정시킨 상태에서, 위쪽 절반을 surface 크기로 지정해서 사용하는 중입니다.
이걸 위, 아래로 분할해서 양쪽 다 사용하고 싶은데요.
어떤식으로 수정하면 되는지 알려주셨으면 합니다.
public class SurfView extends SurfaceView implements SurfaceHolder.Callback
{
....
}
이걸 액티비티에서 받아서
DisplayMetrics metrics = getResources().getDisplayMetrics();
m_nResolWidth = metrics.widthPixels;
m_nResolHeight= metrics.heightPixels;
nRightMargin = 0;
nBottomMargin = m_nResolHeight / 2;
final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(m_nResolWidth, m_nResolHeight);
layoutParams.bottomMargin = nBottomMargin;
layoutParams.rightMargin = nRightMargin;
SurfView m_sfView = new SufView(this);
setContentView(R.layout.activity_main);
m_sfView.setLayoutParams(layoutParams);
layout = (RelativeLayout)findViewById(R.id.layout);
layout.addView(m_sfView);
final RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(m_nResolWidth, m_nResolHeight);
layoutParams.bottomMargin = nBottomMargin;
layoutParams.rightMargin = nRightMargin;
SurfView m_sfView = new SufView(this);
setContentView(R.layout.activity_main);
m_sfView.setLayoutParams(layoutParams);
layout = (RelativeLayout)findViewById(R.id.layout);
layout.addView(m_sfView);
순서가 바꼇을수도 있긴 한데 기기해상도 얻어서 절반을 마진으로 잡아서 addview하는 형식이에요.
1000*1000의 해상도라 가정했을 때 (0.0)~(500.500)의 surfaceview와 (0.500)~(500.1000)의 surfaceview 이렇게 만들려면 어떤식으로 설정해줘야 하는지 알려 주시면 감사하겠습니다..^^