0

Please point me to any links for putting textview on GLSurfaceView.I want to show some varying number in textview. The GLSurfaceView example i am following http://www.learnopengles.com/android-lesson-one-getting-started/

I have modified OnDraw function as follows to calculate fps.

I want to show this fps on GLSurfaceView but i am not understanding how can i do this.

Regards, Mayank

Mayank Agarwal
  • 447
  • 1
  • 7
  • 21
  • 1
    use a FrameLayout with two children: glsurfaceview and textview – pskink Jun 13 '14 at 12:11
  • Multiple examples can be found in Grafika (https://github.com/google/grafika). You may also want to read https://source.android.com/devices/graphics/architecture.html to understand why things work the way they do (SurfaceView can be counter-intuitive). – fadden Jun 13 '14 at 14:32

1 Answers1

1

A sample code.

setContentView(view);
    mTextView = new TextView(this);
    mTextView.setText("YourText");
    mTextView.setTextColor(Color.WHITE);
    mTextView.setTextSize(TypedValue.COMPLEX_UNIT_SP, 32);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;
    addContentView(mTextView, params);
bitsabhi
  • 728
  • 8
  • 12