最新国产好看的视频,伊人天堂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è)畫(huà)筆
  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);
//  畫(huà)什么圓
  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)論

右玉县| 信宜市| 墨竹工卡县| 巴东县| 曲水县| 成武县| 无为县| 重庆市| 化州市| 织金县| 阜城县| 平江县| 紫阳县| 慈利县| 咸丰县| 通许县| 额敏县| 连云港市| 新宾| 淅川县| 永城市| 方正县| 桑植县| 东阳市| 仙桃市| 龙门县| 信丰县| 玉环县| 镇江市| 获嘉县| 江都市| 阿克陶县| 永福县| 电白县| 天台县| 朝阳区| 达尔| 泽州县| 乐陵市| 河北省| 瑞金市|