dimen 를 활용한 모든 기기 화면 최적화
dimen 태그로 dp 값을 저장하여, 해당 값을 pixel로 손쉽게 불러올 수 있다
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="edit_detail_padding">44dp</dimen>
<dimen name="edit_detail_focus_padding">16dp</dimen>
</resources>
val newPadding = resources.getDimensionPixelSize(R.dimen.edit_detail_padding)
val oldPadding = resources.getDimensionPixelSize(R.dimen.edit_detail_focus_padding)
editAlcohol.setOnFocusChangeListener { v, hasFocus ->
if (hasFocus) {
editAlcohol.setPadding(newPadding, oldPadding, oldPadding, oldPadding)
editAlcohol.setBackgroundResource(R.drawable.rect_darkgray2fill_graystroke_14radius)
deleteBtn.visibility = View.INVISIBLE
eraseBtn.visibility = View.VISIBLE
} else {
editAlcohol.setPadding(oldPadding, oldPadding, oldPadding, oldPadding)
editAlcohol.setBackgroundResource(R.drawable.rect_darkgrayfill_graystroke_14radius)
deleteBtn.visibility = View.VISIBLE
eraseBtn.visibility = View.INVISIBLE
}
}