窗体

import android.view.*;

import android.content.Context;

import android.graphics.*;

public class 窗体 extends View{

public 对象 环境=null;

系统线程 xc;

LinearLayout.LayoutParams params=null;

public 窗体(Context c,int x,int y,int w,int h){

super(c);

params = new LinearLayout.LayoutParams(w,h);

setLayoutParams(params);

setX(x);

setY(y);

环境=new 对象(x,y,w,h);

xc=new 系统线程(100){

public void 运行(){

invalidate();

}

};

}

public 窗体(Context c){

super(c);

环境=new 对象(0,0,设备.输出屏幕宽(c),设备.输出屏幕高(c));

params = new LinearLayout.LayoutParams(环境.宽,环境.高);

setLayoutParams(params);

xc=new 系统线程(100){

public void 运行(){

invalidate();

}

};

}

public void draw(Canvas c){

setX(环境.x);

setY(环境.y);

params.width=环境.宽;

params.height=环境.高;

环境.显示(c);

}

public boolean onTouchEvent(MotionEvent e){

环境.事件(e);

invalidate();

return true;

}

public void 设置显示(boolean b){

if(b)setVisibility(View.VISIBLE);

else setVisibility(View.GONE);

}

public void 物理按键(int key,KeyEvent event){

环境.物理按键(key,event);

}

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容