Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - EditText can't be used in SurfaceView?

EditText can't be used in SurfaceView?

Put your problem here if it does not fit any of the other categories.

EditText can't be used in SurfaceView?

Postby play_with_wolf » Thu Nov 04, 2010 3:07 am

Code: Select all
package com.ray.bubble;

import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RectF;
import android.os.Bundle;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.Window;
import android.view.WindowManager;
import android.widget.AbsoluteLayout;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.TextView;

public class BubbleExplosion extends Activity {

private AbsoluteLayout frame;
private MyView myView;
private TextView text;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams. FLAG_FULLSCREEN ,
                      WindowManager.LayoutParams. FLAG_FULLSCREEN);
       
        frame = new AbsoluteLayout(this);
        myView=new MyView(this);

        frame.addView(myView);
        text = new  EditText(this);
        text.setSingleLine(true);
        text.setWidth(200);
       
     
        ///Platform.log(" text.getBackground().getIntrinsicWidth() = "+text.getBackground().getMinimumWidth());
                 AbsoluteLayout.LayoutParams lp1 =
                                new AbsoluteLayout.LayoutParams(
                                                AbsoluteLayout.LayoutParams.WRAP_CONTENT,
                                                AbsoluteLayout.LayoutParams.WRAP_CONTENT,
                                                200,260);
                 frame.addView(text, lp1);
        setContentView(frame);
    }
   
    class MyView extends SurfaceView implements SurfaceHolder.Callback{

     SurfaceHolder holder;
     
     public MyView(Context context) {
      super(context);
      holder = this.getHolder();//获取holder
      holder.addCallback(this);
     }

     public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {

     }

     public void surfaceCreated(SurfaceHolder holder) {
      new Thread(new MyThread()).start();
     }

     public void surfaceDestroyed(SurfaceHolder holder) {

     }

     //内部类的内部类
     class MyThread implements Runnable{

      public void run() {
       Canvas canvas = holder.lockCanvas(null);
       Paint mPaint = new Paint();
       mPaint.setColor(Color.BLUE);

       canvas.drawRect(new RectF(40,60,80,80), mPaint);
       holder.unlockCanvasAndPost(canvas);

      }
     }
    }

}

Image

why? EditText show wrong graphics in SurfaceView?
play_with_wolf
Freshman
Freshman
 
Posts: 3
Joined: Wed Nov 03, 2010 7:57 am

Top

Re: EditText can't be used in SurfaceView?

Postby play_with_wolf » Wed Nov 10, 2010 3:10 am

who can help me?
play_with_wolf
Freshman
Freshman
 
Posts: 3
Joined: Wed Nov 03, 2010 7:57 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 19 guests