퉁탕퉁탕 만들어보자

ImageButton Ripple 주기 본문

Computer/Android

ImageButton Ripple 주기

호숀티 2022. 7. 29. 00:03
반응형

일반 Button에도 이미지를 좌우에 넣을 수있지만,

Image만 있는 Button을 만드는 경우가 있다.

이런 경우에 간단하게 ripple을 넣어주는 방법이 있다.

 

android:background="?attr/selectableItemBackground"

 

를 적용해주면 된다.

 

팁2. 

constraint layout에서 간단하게 버튼 크기 정하기

app:layout_constraintDimensionRatio="1:1"로 비율을 정해줄 수 있다.

이때 원하는대로 비율을 지정해 주면 된다.

728x90
반응형

'Computer > Android' 카테고리의 다른 글

앱 권한 요청하기  (0) 2022.07.29
SoundPool을 활용해서 sound 효과 주기  (0) 2022.07.29
Android broadcast 수신  (0) 2022.05.09
Android Webview Javascript interface  (1) 2022.05.08
View Binding  (0) 2022.05.08