android:shape="oval" >

android:height="50dp"/>

布局xml文件中使用imageview控件

(2)绘制直线

android:shape="line" >

android:color="#ff0000" //颜色

android:dashWidth="2dp" //虚线的线段长度

android:dashGap="3dp"/> //虚线的间隔长度

(3)绘制矩形

android:shape="rectangle" >

android:angle="45" //渐变角度 45的整数倍

android:centerColor="#00ff00" //渐变颜色

android:endColor="#0000ff"

android:startColor="#ff0000" />

//纯色

android:height="100dp"

android:width="50dp" />

//圆角

(4)使用自定义字体

TextView textView = (TextView) findViewById(R.id.textView2);

Typeface tf = Typeface.createFromAsset(getAssets(),

"fonts/samplefont.ttf");

//读取****字体****textView.setTypeface(tf);//设置****字体****

把****字体****格式文件.ttf,拷贝到assets目录下,读取****字体****文件Typeface.createFromAsset,设置类型setTypeface
Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐