본문 바로가기
Android/공부

안드로이드 버튼 최상위로 보일때. 문제

by 므시칸곰틔군 2018. 4. 18.

안드로이드 액티비티에서 기본 레이아웃에서 

버튼, 텍스트뷰, 프래임레이아웃(프래그먼트 컨테이너) 등등 위젯을 등록 하고

앱을 실행하여 액티비티 후 프래그먼트를 실행하면 액티비티의 버튼이 프래그먼트 레이아웃 위에

나타난 경우가 있다.


두가지 ? 해결방법이 있는데.

하나는 액티비티 레이아웃에서 

기본레이아웃 말고 또다른 레이아웃을 감싸는 것과.

ㅇㅇ

버튼에 android:stateListAnimator="@null"  를 추가 하는 것이다.


z-index in Relative layout

https://stackoverflow.com/questions/27132825/z-index-in-relative-layout/38534042 


Buttons in Lollipop and higher have a default elevation to them which causes them to always draw on top. You can change this by overriding the default StateListAnimator.

Try putting this into your button XML:

android:stateListAnimator="@null"

The FrameLayout should now cover the button.