最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

Android空心圓及層疊效果實(shí)現(xiàn)代碼

 更新時(shí)間:2017年10月08日 10:19:44   作者:wyj1369  
這篇文章主要為大家詳細(xì)介紹了Android空心圓及層疊效果實(shí)現(xiàn)代碼,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了Android空心圓及層疊效果的具體代碼,供大家參考,具體內(nèi)容如下

package com.bwei.test.zidingyiview2;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;


public class MyView extends View {
 private Context mcontext;
 private Paint mpaint;

 public MyView(Context context) {
  super(context);
 }

 public MyView(Context context, AttributeSet attrs) {
  super(context, attrs);
 }

 public MyView(Context context, AttributeSet attrs, int defStyleAttr) {
  super(context, attrs, defStyleAttr);
  this.mcontext = context;
 }

 @Override
 protected void onDraw(Canvas canvas) {
  super.onDraw(canvas);
//  得到屏幕寬高
  float wi = canvas.getWidth() / 2;
  float he = canvas.getHeight() / 2;
//  創(chuàng)建第一個(gè)畫筆
  Paint pa = new Paint();
//  上色
  pa.setColor(Color.GREEN);
//  顯示圓邊
  pa.setAntiAlias(true);
//  設(shè)置空心圓環(huán)
  pa.setStyle(Paint.Style.STROKE);
//  設(shè)置圓環(huán)寬度
  pa.setStrokeWidth(6);
  Paint pa2 = new Paint();
  pa2.setColor(Color.BLUE);
  pa2.setAntiAlias(true);
  Paint pa3 = new Paint();
  pa3.setColor(Color.BLACK);
  pa3.setAntiAlias(true);
//  畫什么圓
  canvas.drawCircle(wi-85, he-85, 80, pa2);
  canvas.drawCircle(wi, he, 100, pa);
  canvas.drawCircle(wi+110, he+110, 120, pa3);
 }
}

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
 xmlns:android="http://schemas.android.com/apk/res/android"
 xmlns:tools="http://schemas.android.com/tools"
 android:id="@+id/activity_main"
 android:layout_width="match_parent"
 android:layout_height="match_parent"
 android:paddingBottom="@dimen/activity_vertical_margin"
 android:paddingLeft="@dimen/activity_horizontal_margin"
 android:paddingRight="@dimen/activity_horizontal_margin"
 android:paddingTop="@dimen/activity_vertical_margin"
 tools:context="com.bwei.test.zidingyiview2.MainActivity">

 <com.bwei.test.zidingyiview2.MyView
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"/>
</RelativeLayout>

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

最新評(píng)論

文安县| 道真| 陕西省| 乡城县| 繁峙县| 大荔县| 庄浪县| 祁门县| 邢台市| 平度市| 黄平县| 尼玛县| 东海县| 许昌县| 新河县| 鄂尔多斯市| 海晏县| 五原县| 高碑店市| 金门县| 石渠县| 靖安县| 海淀区| 宁强县| 瑞金市| 凤阳县| 育儿| 景谷| 高台县| 元阳县| 三门峡市| 泾川县| 十堰市| 岫岩| 剑川县| 白城市| 安吉县| 自治县| 勃利县| 正阳县| 曲松县|