导航:首页 > 操作系统 > android去锯齿

android去锯齿

发布时间:2024-11-11 16:25:57

android设计中如何随机生成一个方格界面,类似于棋盘那种,用什么函数实现

public class MainActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

MyView mv = new MyView(this);
setContentView(mv);
}
public class MyView extends View {
MyView(Context context) {
super(context);
}
private int startX = 0; //起始位置
private int startY = 0;
private int GRID_WIDTH = 30; //格子的高和宽
private int GRID_NUM = 12;//要画的棋盘中的线数
Paint paint = new Paint();//定义画笔
@Override
protected void onDraw(Canvas canvas) {
// TODO Auto-generated method stub
super.onDraw(canvas);
paint.setColor(0xffff0000);//设置画笔的颜色
paint.setAntiAlias(true);//去锯齿

for(int i=0;i<GRID_NUM;i++)
{
//画横线
canvas.drawLine(startX, startY+i*GRID_WIDTH,startX+(GRID_NUM-1)*GRID_WIDTH , startY+i*GRID_WIDTH, paint);
//画纵线
canvas.drawLine(startX+i*GRID_WIDTH, startY,startX+i*GRID_WIDTH , startY+(GRID_NUM-1)*GRID_WIDTH, paint);
}
}

}
}

我已经尽力来……

❷ android 怎么画2层圆环

Android绘制两层圆环,可以使用自定义View,继承View,重写里面的Ondraw方法,花两个同心圆,示例如下:

java">packagecom.cn.myvn;

importandroid.content.Context;
importandroid.graphics.Canvas;
importandroid.graphics.Paint;
importandroid.util.AttributeSet;
importandroid.view.View;

{

privatefinalPaintpaint;
privatefinalContextcontext;

publicRingView(Contextcontext){

//TODOAuto-generatedconstructorstub
this(context,null);
}

publicRingView(Contextcontext,AttributeSetattrs){
super(context,attrs);
//TODOAuto-generatedconstructorstub
this.context=context;
this.paint=newPaint();
this.paint.setAntiAlias(true);//消除锯齿
this.paint.setStyle(Paint.Style.STROKE);//绘制空心圆
}

@Override
protectedvoidonDraw(Canvascanvas){
//TODOAuto-generatedmethodstub
intcenter=getWidth()/2;
intinnerCircle=dip2px(context,83);//设置内圆半径
intringWidth=dip2px(context,5);//设置圆环宽度

//绘制内圆
this.paint.setARGB(155,167,190,206);
this.paint.setStrokeWidth(2);
canvas.drawCircle(center,center,innerCircle,this.paint);

//绘制圆环
this.paint.setARGB(255,212,225,233);
this.paint.setStrokeWidth(ringWidth);
canvas.drawCircle(center,center,innerCircle+1+ringWidth/2,this.paint);

//绘制外圆
this.paint.setARGB(155,167,190,206);
this.paint.setStrokeWidth(2);
canvas.drawCircle(center,center,innerCircle+ringWidth,this.paint);

super.onDraw(canvas);
}
}

❸ Android 如何在数字上加一条横线,求代码,哪位大牛帮下忙啊

这要要在代码中设置
textView.getPaint().setFlags(Paint. UNDERLINE_TEXT_FLAG ); //下划线
textView.getPaint().setAntiAlias(true);//抗锯齿
textview.getPaint().setFlags(Paint. STRIKE_THRU_TEXT_FLAG); //中划线
setFlags(Paint. STRIKE_THRU_TEXT_FLAG|Paint.ANTI_ALIAS_FLAG); // 设置中划线并加清晰
textView.getPaint().setFlags(0); // 取消设置的的划线

阅读全文

与android去锯齿相关的资料

热点内容
压缩空气气压检测接线 浏览:332
摄影构图与图像语言pdf 浏览:881
程序员那么可爱啃螃蟹 浏览:758
变频压缩机启动但是没有进气排气 浏览:77
惠民宝盒app怎么下载 浏览:722
网监APP怎么下载 浏览:115
app里面会动的箭头怎么做的 浏览:210
编译原理湖南大学 浏览:859
怎么下ea服务器 浏览:440
java下载response 浏览:160
服务器自带修复光盘是什么意思 浏览:648
郑州市房屋解压流程 浏览:318
本地分支如何提交到服务器版本 浏览:424
不规则面积算法 浏览:447
exe文件打开是命令窗口 浏览:878
安卓怎么选择3g网 浏览:738
单片机进制转换视频 浏览:983
什么专业就业单片机 浏览:531
九宫格文件夹名称 浏览:48
崩坏3通过uid判断什么服务器 浏览:337