So. Google+ 앱에서 소식을 클릭하면 전체보기가 파란색으로 변하는 것을 알 수 있습니다. 그뿐만 아니라 ImageView를 사용하고 싶습니다.보기에서 투명한 색상 강조 표시를 클릭했을 때
실제 이미지를 배경으로 설정하고 선택자를 주 리소스로 설정하는 다음 코드 단편을 가지고 있습니다. 이 좋은 보이지만, 배경 이미지에 대한 scaleType을 존중하지 않습니다
<item android:state_pressed="true">
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#44521400" />
</shape></item>
어떻게 만들 수 있습니다 : 그런데
<ImageView
android:id="@+id/painting_image"
android:layout_width="match_parent"
android:layout_height="200dp"
android:background="@drawable/img"
android:src="@drawable/selector"
android:scaleType="centerCrop" />
, @drawable/selector
는 state_pressed
에 대한 tranparent 색상을 보여줍니다 단지 선택이다 이 작업은 scaleType을 존중하면서?
의미가 있습니다 ... 더 나아졌습니다! –
예 : imagebutton_selector.xml : xml version = "1.0"encoding = "utf-8"?> - drawable = "@ color/bg_window"/>
' –
moondroid