From 1b112103b7f53225f58a2956ac6ceabf2e212c41 Mon Sep 17 00:00:00 2001 From: endian11 <Dana_Lee1016@126.com> Date: 星期三, 11 九月 2019 13:21:14 +0800 Subject: [PATCH] 动态设置场地5大考试项目; --- app/src/main/java/safeluck/drive/evaluation/customview/HouseView.java | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/safeluck/drive/evaluation/customview/HouseView.java b/app/src/main/java/safeluck/drive/evaluation/customview/HouseView.java index a324800..122f01f 100644 --- a/app/src/main/java/safeluck/drive/evaluation/customview/HouseView.java +++ b/app/src/main/java/safeluck/drive/evaluation/customview/HouseView.java @@ -1,6 +1,7 @@ package safeluck.drive.evaluation.customview; import android.content.Context; +import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; @@ -12,6 +13,7 @@ import android.util.TypedValue; import android.view.View; +import safeluck.drive.evaluation.R; import safeluck.drive.evaluation.util.Utils; /** @@ -27,20 +29,23 @@ private float PADDING = Utils.px2dp(40); private double a = Math.toRadians(55.0); private int color = Color.parseColor("#99C3D1"); - private String text = "鍊掕溅鍏ュ簱"; + private String text ; public HouseView(Context context) { - super(context); + this(context,null); } public HouseView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); + TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.ArrowView,defStyleAttr,0); + text = typedArray.getString(R.styleable.ArrowView_text); + typedArray.recycle(); } public HouseView(Context context, @Nullable AttributeSet attrs) { - super(context, attrs); + this(context, attrs,0); } @Override -- Gitblit v1.8.0