前幾天寫了一個(gè)小工具,其中一個(gè)設(shè)置項(xiàng)需要屏幕區(qū)域范圍坐標(biāo)參數(shù)斋陪,由于通過(guò)觀察直接填寫坐標(biāo)信息不太現(xiàn)實(shí)癌淮,于是就有了通過(guò)直接拖拽屏幕去取這個(gè)參數(shù)的需求,又因?yàn)樾枰谌我饨缑娑寄苓x取舔箭,所以就想到了懸浮窗,這里以前寫過(guò)一個(gè)懸浮窗工具類《FloatWindowUtils 實(shí)現(xiàn)及事件沖突解決詳解》蚊逢,想著再加一些手勢(shì)及繪制應(yīng)該就能實(shí)現(xiàn)层扶,于是吭嘰吭嘰搞了半天,發(fā)現(xiàn)其中還是有些坑的烙荷,所以在此記錄備忘镜会。
效果圖和用法如下:
如上圖,這個(gè) View 的功能很簡(jiǎn)單终抽,就是在屏幕上彈出一個(gè)全屏懸浮窗遮罩戳表,然后在上面拖拽選擇區(qū)域焰薄,最后保存坐標(biāo)信息就好了。
詳細(xì)實(shí)現(xiàn)我就不講了扒袖,后面會(huì)貼源碼塞茅,這里主要講一下實(shí)現(xiàn)思路和幾個(gè)需要注意的點(diǎn)
實(shí)現(xiàn)思路
繼承 View 還是 ViewGroup
由于懸浮窗里需要有提示文字以及取消和保存兩個(gè)按鈕,所以我沒(méi)有直接去繼承 View 來(lái)寫季率,直接繼承 View 來(lái)實(shí)現(xiàn)當(dāng)然也可以野瘦,但是需要把下面的文字以及按鈕都畫出來(lái),可能還需要內(nèi)置按鈕的觸發(fā)回調(diào)等等業(yè)務(wù)飒泻,最終我選擇了繼承 ViewGroup(ConstrainsLayout) 來(lái)實(shí)現(xiàn)鞭光,這樣做可以共享 ConstrainsLayout 的所有屬性。和直接繼承 View 實(shí)現(xiàn)相比泞遗,它的優(yōu)點(diǎn)就是可以在布局文件中方便的添加子 View惰许,缺點(diǎn)是集成度不夠高,需要引用外部資源史辙,所以具體實(shí)現(xiàn)可以看使用場(chǎng)景汹买,這里沒(méi)有復(fù)用的場(chǎng)景,集成度要求不高聊倔,所以就選擇了更簡(jiǎn)單的繼承 ViewGroup 來(lái)實(shí)現(xiàn)晦毙。
class AreaSelectLayout : ConstraintLayout {
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
}
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean {
return super.onTouchEvent(event)
}
}
<?xml version="1.0" encoding="utf-8"?>
<com.example.area_select_layout.AreaSelectLayout
...
android:background="@color/half_trans">
<ImageButton
android:id="@+id/btn_save"
... />
<ImageButton
android:id="@+id/btn_cancel"
... />
<LinearLayout ...>
<TextView
android:id="@+id/textView4"
android:text="拖動(dòng)選取"
... />
<TextView
android:id="@+id/textView5"
android:text="起始"
... />
<TextView
android:text="和"
... />
<TextView
android:text="結(jié)束"
... />
<TextView
android:text="區(qū)域"
... />
</LinearLayout>
</com.example.area_select_layout.AreaSelectLayout>
跟隨手指移動(dòng)繪制方框
區(qū)域選擇,其實(shí)就是在屏幕上畫對(duì)角線耙蔑,手指落下见妒,記錄起點(diǎn),手指移動(dòng)甸陌,不斷更新終點(diǎn)并通知 Canvas 畫出來(lái)须揣,手指抬起,保存最終坐標(biāo)钱豁。這里需要注意的是 Y 坐標(biāo)要減去 StatusBar 的高度耻卡。
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean {
when (event.action) {
MotionEvent.ACTION_DOWN -> {
// 記錄起點(diǎn)位置
setStartPos(event.rawX.toInt(), (event.rawY - statusBarHeight).toInt())
}
MotionEvent.ACTION_MOVE -> {
// 更新終點(diǎn)位置
setStopPos(event.rawX.toInt(), (event.rawY - statusBarHeight).toInt())
// 使布局失效,讓系統(tǒng)觸發(fā) onDraw 重繪界面
invalidate()
}
}
return super.onTouchEvent(event)
}
位置存儲(chǔ)以及方向判斷
由于位置總共有四個(gè)點(diǎn)寥院,八個(gè)坐標(biāo)值劲赠,用變量來(lái)存很不便涛目,所以我直接用 Rect 來(lái)存了秸谢,一是便于管理,可以用這些值方便的判斷正在選區(qū)起始區(qū)域或是結(jié)束區(qū)域霹肝,二是可以直接通過(guò) Canvas.drawRect(Rect, Paint) 來(lái)繪制方框了估蹄。
private fun setStartPos(rawX: Int, rawY: Int) {
// 起始區(qū)域已經(jīng)繪制
if (startRect.bottom != 0) {
startSelected = true
}
// 如果存在兩個(gè)選區(qū)的話,則清屏重繪制
if (startRect.bottom != 0 && endRect.bottom != 0) {
clear()
}
// 判斷落點(diǎn)屬于起始區(qū)域還是結(jié)束區(qū)域
if (startSelected) {
end.x = rawX
end.y = rawY
} else {
start.x = rawX
start.y = rawY
}
}
private fun setStopPos(rawX: Int, rawY: Int) {
// 判斷終點(diǎn)屬于起始區(qū)域還是結(jié)束區(qū)域
if (startSelected) {
// rawX < end.x 表示從左向右拖動(dòng) ?
// ? 時(shí) x 更新 right沫换,y 同理
endRect.left = if (rawX < end.x) rawX else end.x
// rawX > end.x 表示從右向左拖動(dòng) ?
// ? 時(shí) x 更新 left臭蚁,y 同理
endRect.right = if (rawX > end.x) rawX else end.x
endRect.top = if (rawY < end.y) rawY else end.y
endRect.bottom = if (rawY > end.y) rawY else end.y
} else {
startRect.left = if (rawX < start.x) rawX else start.x
startRect.right = if (rawX > start.x) rawX else start.x
startRect.top = if (rawY < start.y) rawY else start.y
startRect.bottom = if (rawY > start.y) rawY else start.y
}
}
使布局懸浮在應(yīng)用之外
這塊考慮了一下,最后還是沒(méi)有用 FloatWindowUtils,因?yàn)榫鸵粋€(gè)布局垮兑,了解了懸浮窗怎么玩之后冷尉,懸浮起一個(gè)布局也很簡(jiǎn)單,直接用 WindowManager 十幾行代碼搞定了系枪。
private fun showSelectLayout() {
if (!SystemSetings.isAppOpsOn(this)) {
SystemSetings.openOpsSettings(this)
Toast.makeText(this,"請(qǐng)先開(kāi)啟懸浮窗權(quán)限",Toast.LENGTH_SHORT).show()
return
}
wm = getSystemService(Context.WINDOW_SERVICE) as WindowManager
val lp = WindowManager.LayoutParams()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
} else {
lp.type = WindowManager.LayoutParams.TYPE_PHONE
}
lp.format = PixelFormat.TRANSLUCENT
lp.flags = lp.flags or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.MATCH_PARENT
lp.gravity = Gravity.END or Gravity.TOP
if (selectLayout.parent!=null){
wm.removeView(selectLayout)
}
wm.addView(selectLayout, lp)
}
核心部分基本就是上面這些了雀哨,算位置的時(shí)候稍微有點(diǎn)繞但是不難,多分析下就出來(lái)了私爷,下面貼下源碼
項(xiàng)目源碼
manifests.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.area_select_layout">
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
MainActivity.kt
class MainActivity : AppCompatActivity() {
private lateinit var selectLayout: AreaSelectLayout
private lateinit var btnSave: View
private lateinit var btnCancel: View
private lateinit var wm: WindowManager
@SuppressLint("SetTextI18n")
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
selectLayout = View.inflate(this,R.layout.dialog_select_layout,null) as AreaSelectLay
btnSave = selectLayout.findViewById(R.id.btn_save)
btnCancel = selectLayout.findViewById(R.id.btn_cancel)
btnSave.setOnClickListener {
hideSelectLayout()
val startRect = selectLayout.getStartRect()
val endRect = selectLayout.getEndRect()
textView.text = "start-area:[${startRect.left},${startRect.top}]," +
"[${startRect.right},${startRect.bottom}]" +
"\n" +
"end-area:[${endRect.left},${endRect.top}]," +
"[${endRect.right},${endRect.bottom}]"
}
btnCancel.setOnClickListener {
hideSelectLayout()
selectLayout.clear()
}
button.setOnClickListener {
showSelectLayout()
}
}
private fun hideSelectLayout() {
wm.removeView(selectLayout)
}
private fun showSelectLayout() {
if (!SystemSetings.isAppOpsOn(this)) {
SystemSetings.openOpsSettings(this)
Toast.makeText(this,"請(qǐng)先開(kāi)啟懸浮窗權(quán)限",Toast.LENGTH_SHORT).show()
return
}
// 設(shè)置位置
wm = getSystemService(Context.WINDOW_SERVICE) as WindowManager
val lp = WindowManager.LayoutParams()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
lp.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
} else {
lp.type = WindowManager.LayoutParams.TYPE_PHONE
}
lp.format = PixelFormat.TRANSLUCENT
lp.flags = lp.flags or WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
lp.width = WindowManager.LayoutParams.MATCH_PARENT
lp.height = WindowManager.LayoutParams.MATCH_PARENT
lp.gravity = Gravity.END or Gravity.TOP
if (selectLayout.parent!=null){
wm.removeView(selectLayout)
}
wm.addView(selectLayout, lp)
}
}
AreaSelectLayout.kt
class AreaSelectLayout : ConstraintLayout {
private var paint = Paint(Paint.ANTI_ALIAS_FLAG)
private var endPaint = Paint(Paint.ANTI_ALIAS_FLAG)
private var paintText = Paint(Paint.ANTI_ALIAS_FLAG)
/**
* 滑動(dòng)范圍
*/
private var startRect = Rect()
private var endRect = Rect()
/**
* 坐標(biāo)文字邊框
*/
private var ltStrBounds = Rect()
private var rbStrBounds = Rect()
private var start = Point()
private var end = Point()
private var startSelected = false
private val statusBarHeight: Int
get() {
val resourceId = resources.getIdentifier("status_bar_height", "dimen", "android")
return resources.getDimensionPixelSize(resourceId)
}
constructor(context: Context) : super(context) {}
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) {}
init {
paint.strokeWidth = dp2px(2f)
paint.style = Paint.Style.STROKE
paint.color = Color.parseColor("#1aad19")
endPaint.strokeWidth = dp2px(2f)
endPaint.style = Paint.Style.STROKE
endPaint.color = Color.parseColor("#f45454")
paintText.textSize = dp2px(12f)
paintText.color = Color.parseColor("#1aad19")
}
override fun onDraw(canvas: Canvas) {
super.onDraw(canvas)
// 繪制結(jié)束區(qū)域
canvas.drawRect(endRect, endPaint)
// 繪制起始區(qū)域
canvas.drawRect(startRect, paint)
}
@SuppressLint("ClickableViewAccessibility")
override fun onTouchEvent(event: MotionEvent): Boolean {
when (event.action) {
MotionEvent.ACTION_DOWN -> {
setStartPos(event.rawX.toInt(), (event.rawY - statusBarHeight).toInt())
}
MotionEvent.ACTION_MOVE -> {
setStopPos(event.rawX.toInt(), (event.rawY - statusBarHeight).toInt())
invalidate()
}
}
return super.onTouchEvent(event)
}
private fun setStartPos(rawX: Int, rawY: Int) {
if (startRect.bottom != 0) {
startSelected = true
}
if (startRect.bottom != 0 && endRect.bottom != 0) {
clear()
}
if (startSelected) {
end.x = rawX
end.y = rawY
} else {
start.x = rawX
start.y = rawY
}
}
private fun setStopPos(rawX: Int, rawY: Int) {
if (startSelected) {
endRect.left = if (rawX < end.x) rawX else end.x
endRect.right = if (rawX > end.x) rawX else end.x
endRect.top = if (rawY < end.y) rawY else end.y
endRect.bottom = if (rawY > end.y) rawY else end.y
} else {
startRect.left = if (rawX < start.x) rawX else start.x
startRect.right = if (rawX > start.x) rawX else start.x
startRect.top = if (rawY < start.y) rawY else start.y
startRect.bottom = if (rawY > start.y) rawY else start.y
}
}
fun clear() {
startSelected = false
startRect.top = 0
startRect.bottom = 0
startRect.left = 0
startRect.right = 0
endRect.top = 0
endRect.bottom = 0
endRect.left = 0
endRect.right = 0
invalidate()
}
fun setStartRect(rect: Rect) {
this.startRect = rect
}
fun getStartRect(): Rect {
// val rstRect = startRect
// rstRect.top += statusBarHeight
// rstRect.bottom += statusBarHeight
return startRect
}
fun setEndRect(rect: Rect) {
this.endRect = rect
}
fun getEndRect(): Rect {
// val rstRect = endRect
// rstRect.top += statusBarHeight
// rstRect.bottom += statusBarHeight
return endRect
}
fun dp2px(dp: Float): Float {
return TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, Resources.getSystem().displayMetrics)
}
}
SystemSetings.kt
/**
* Created by skyrin on 2016/9/25.
* 系統(tǒng)設(shè)置相關(guān)
*/
object SystemSetings {
/**
* 輔助服務(wù)是否開(kāi)啟
* @param context
* @return true if Accessibility is on.
*/
fun isAccessibilitySettingsOn(context: Context): Boolean {
var i: Int
try {
i = Settings.Secure.getInt(context.contentResolver, "accessibility_enabled")
} catch (e: Settings.SettingNotFoundException) {
Log.i("AccessibilitySettingsOn", e.message)
i = 0
}
if (i != 1) {
return false
}
val string = Settings.Secure.getString(context.contentResolver, "enabled_accessibility_services")
return string?.toLowerCase()?.contains(context.packageName.toLowerCase()) ?: false
}
/**
* 打開(kāi)輔助服務(wù)的設(shè)置
*/
fun openAccessibilityServiceSettings(context: Context): Boolean {
var result = true
try {
val intent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS)
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
context.startActivity(intent)
} catch (e: Exception) {
result = false
e.printStackTrace()
}
return result
}
/** 打開(kāi)通知欄設(shè)置 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP_MR1)
fun openNotificationServiceSettings(context: Context) {
try {
val intent = Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS)
context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
}
}
/**
* 打開(kāi)app權(quán)限的設(shè)置
* @param context
* @return
*/
fun openFloatWindowSettings(context: Context): Boolean {
try {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", context.packageName, null)
intent.data = uri
context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
return false
}
return true
}
/**
* 打開(kāi)app權(quán)限的設(shè)置
* @param context
* @return
*/
fun openFloatWindowSettings(context: Context, pkgName: String): Boolean {
try {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", pkgName, null)
intent.data = uri
context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
return false
}
return true
}
/**
* 打開(kāi)懸浮窗設(shè)置頁(yè)
* 部分第三方ROM無(wú)法直接跳轉(zhuǎn)可使用[.openAppSettings]跳到應(yīng)用詳情頁(yè)
*
* @param context
* @return true if it's open successful.
*/
fun openOpsSettings(context: Context): Boolean {
try {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
val intent = Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:" + context.packageName))
context.startActivity(intent)
} else {
return openAppSettings(context)
}
} catch (e: Exception) {
e.printStackTrace()
return false
}
return true
}
/**
* 打開(kāi)應(yīng)用詳情頁(yè)
*
* @param context
* @return true if it's open success.
*/
fun openAppSettings(context: Context): Boolean {
try {
val intent = Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS)
val uri = Uri.fromParts("package", context.packageName, null)
intent.data = uri
context.startActivity(intent)
} catch (e: Exception) {
e.printStackTrace()
return false
}
return true
}
/**
* 判斷 懸浮窗口權(quán)限是否打開(kāi)
* 由于android未提供直接跳轉(zhuǎn)到懸浮窗設(shè)置頁(yè)的api雾棺,此方法使用反射去查找相關(guān)函數(shù)進(jìn)行跳轉(zhuǎn)
* 部分第三方ROM可能不適用
*
* @param context
* @return true 允許 false禁止
*/
fun isAppOpsOn(context: Context): Boolean {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
return Settings.canDrawOverlays(context)
}
try {
val `object` = context.getSystemService(Context.APP_OPS_SERVICE) ?: return false
val localClass = `object`.javaClass
val arrayOfClass = arrayOfNulls<Class<*>>(3)
arrayOfClass[0] = Integer.TYPE
arrayOfClass[1] = Integer.TYPE
arrayOfClass[2] = String::class.java
val method = localClass.getMethod("checkOp", *arrayOfClass) ?: return false
val arrayOfObject1 = arrayOfNulls<Any>(3)
arrayOfObject1[0] = 24
arrayOfObject1[1] = Binder.getCallingUid()
arrayOfObject1[2] = context.packageName
val m = method.invoke(`object`, *arrayOfObject1) as Int
return m == AppOpsManager.MODE_ALLOWED
} catch (ex: Exception) {
ex.stackTrace
}
return false
}
/**
* 啟動(dòng)app
*
* @param context
* @param pkgName 包名
* @return 是否啟動(dòng)成功
*/
fun startApp(context: Context, pkgName: String): Boolean {
try {
val manager = context.packageManager
val openApp = manager.getLaunchIntentForPackage(pkgName) ?: return false
openApp.flags = Intent.FLAG_ACTIVITY_SINGLE_TOP
context.startActivity(openApp)
} catch (e: Exception) {
return false
}
return true
}
}
activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="160dp"
android:text="選擇區(qū)域"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.498"
app:layout_constraintStart_toStartOf="parent" />
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="80dp"
android:text="TextView"
app:layout_constraintBottom_toTopOf="@+id/button"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" />
</android.support.constraint.ConstraintLayout>
dialog_select_layout.xml
<?xml version="1.0" encoding="utf-8"?>
<com.example.area_select_layout.AreaSelectLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@color/half_trans">
<ImageButton
android:id="@+id/btn_save"
android:layout_width="48dp"
android:layout_height="48dp"
android:background="@null"
android:src="@drawable/ic_ok"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<ImageButton
android:id="@+id/btn_cancel"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginBottom="0dp"
android:background="@null"
android:src="@drawable/ic_cancel"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="0dp"
android:layout_marginEnd="8dp"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/btn_save">
<TextView
android:id="@+id/textView4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="拖動(dòng)選取"
android:textColor="@color/white"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="@+id/btn_save"
app:layout_constraintVertical_bias="0.448"
tools:layout_editor_absoluteX="61dp" />
<TextView
android:id="@+id/textView5"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="起始"
android:textColor="#1aad19"
tools:layout_editor_absoluteX="162dp"
tools:layout_editor_absoluteY="476dp" />
<TextView
android:id="@+id/textView6"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="和"
android:textColor="@color/white"
tools:layout_editor_absoluteX="209dp"
tools:layout_editor_absoluteY="475dp" />
<TextView
android:id="@+id/textView7"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="結(jié)束"
android:textColor="#f45454"
tools:layout_editor_absoluteX="243dp"
tools:layout_editor_absoluteY="474dp" />
<TextView
android:id="@+id/textView8"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="區(qū)域"
android:textColor="@color/white"
tools:layout_editor_absoluteX="276dp"
tools:layout_editor_absoluteY="474dp" />
</LinearLayout>
</com.example.area_select_layout.AreaSelectLayout>
colors.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#008577</color>
<color name="colorPrimaryDark">#00574B</color>
<color name="colorAccent">#D81B60</color>
<color name="red">#d02129</color>
<color name="vip">#f5b53a</color>
<color name="light_red">#ff620d</color>
<color name="blue">#1189ff</color>
<color name="blue_dark">#ff187998</color>
<color name="white">#FFF</color>
<color name="green">#ff1ce322</color>
<color name="grey">#eeeffd</color>
<color name="dark_gray">#525252</color>
<color name="black">#000000</color>
<color name="main">#09537a</color>
<color name="main_trans">#991296db</color>
<color name="full_trans">#00000000</color>
<color name="no_trans">#00000001</color>
<color name="half_trans">#80000000</color>
<color name="status_bar">#09537a</color>
<color name="df_layout">#fafafa</color>
<color name="main_gray">#f5f5f5</color>
<color name="waring">#ff620d</color>
<color name="room_panel_bg">#80000000</color>
<color name="sys_msg_bg">#b4b4b4</color>
<color name="dialogue_msg">#3e3f3f</color>
<color name="green0">#45C01A</color>
<color name="green1">#45C01A</color>
<color name="green2">#A3DEA3</color>
<color name="green3">#1AAD19</color>
<color name="ok">#1aad19</color>
<color name="no">#ff620d</color>
<color name="alpha_05_black">#0D000000</color>
<color name="alpha_10_black">#1A000000</color>
<color name="alpha_15_black">#26000000</color>
<color name="alpha_20_black">#33000000</color>
<color name="alpha_25_black">#40000000</color>
<color name="alpha_30_black">#4D000000</color>
<color name="alpha_33_black">#54000000</color>
<color name="alpha_35_black">#59000000</color>
<color name="alpha_40_black">#66000000</color>
<color name="alpha_45_black">#73000000</color>
<color name="alpha_50_black">#80000000</color>
<color name="alpha_55_black">#8C000000</color>
<color name="alpha_60_black">#99000000</color>
<color name="alpha_65_black">#A6000000</color>
<color name="alpha_70_black">#B3000000</color>
<color name="alpha_75_black">#BF000000</color>
<color name="alpha_80_black">#CC000000</color>
<color name="alpha_85_black">#D9000000</color>
<color name="alpha_90_black">#E6000000</color>
<color name="alpha_95_black">#F2000000</color>
</resources>