플로팅 작업 버튼에 아이콘의 색조를 설정하는 매우 간단한 작업을 시도하고 있지만 색조 속성은 색상을 변경하지 않습니다.
아이콘의 XML 자체를 변경 한 후에도 플로팅 작업 버튼이 아이콘을 검은 색으로 유지하는 것처럼 보입니다.
아이콘을 흰색으로 변경하고 싶습니다!
FAB XML :
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/createPostBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="16dp"
android:backgroundTint="#006993"
android:clickable="true"
android:focusable="true"
android:src="@drawable/ic_textpost"
android:tint="@color/white"
app:layout_constraintBottom_toTopOf="@+id/add_btn"
app:layout_constraintEnd_toEndOf="@+id/add_btn" />
ic_textpost.xml :
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="@color/white">
<path
android:fillColor="@android:color/white"
android:pathData="M17,19.22H5V7h7V5H5C3.9,5 3,5.9 3,7v12c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2v-7h-2V19.22z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M19,2h-2v3h-3c0.01,0.01 0,2 0,2h3v2.99c0.01,0.01 2,0 2,0V7h3V5h-3V2z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M7,9h8v2h-8z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M7,12l0,2l8,0l0,-2l-3,0z"/>
<path
android:fillColor="@android:color/white"
android:pathData="M7,15h8v2h-8z"/>
</vector>
색상을 설정하는 app:tint
것이 아니라 를 사용해야 android:tint
합니다.
공식 자료 문서를 참조하십시오. 그동안 꽤 좋습니다.
https://material.io/components/buttons-floating-action-button/android#fabs
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다