簡體   English   中英

通過可繪制對象更改浮動操作按鈕的背景

[英]Change the floating action button background by a drawable

我想用一個drawable替換浮動動作按鈕的圓圈,我在github上使用了這個晶圓廠,因為使用了SDK 14,所以我正在使用這個晶圓廠

這是xml文件:

      <com.getbase.floatingactionbutton.FloatingActionsMenu
            android:id="@+id/multiple_actions_saisiev2"
            android:layout_width="179dp"
            android:layout_height="368dp"
            android:layout_alignParentBottom="true"
            android:layout_alignParentRight="true"
            android:layout_alignParentEnd="false"
            fab:fab_addButtonColorNormal="@color/dull_yellow"
            fab:fab_addButtonColorPressed="@color/dull_yellow"
            fab:fab_addButtonPlusIconColor="#182740"

            android:layout_marginBottom="100dp"
            android:layout_marginRight="30dp">

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/fab_contre"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                fab:fab_colorNormal="@color/vert_fab"
                fab:fab_title="@string/contre"
                fab:fab_addButtonPlusIconColor="#FFFFFF"
                fab:fab_colorPressed="@color/vert_fab"/>

            <com.getbase.floatingactionbutton.FloatingActionButton
                android:id="@+id/fab_perte"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                fab:fab_colorNormal="@color/vert_fab"
                fab:fab_title="@string/perte"
                fab:fab_addButtonPlusIconColor="#FFFFFF"
                fab:fab_colorPressed="@color/vert_fab"/>

        </com.getbase.floatingactionbutton.FloatingActionsMenu>

如果我使用android:background,它將無法正常工作;如果我在JAVA中更改背景,則png會出現在按鈕的背景上。 我試圖修改庫,但是當我嘗試修改某些東西時什么也沒出現。

謝謝

我想這應該會有所幫助...將“浮動操作按鈕”設置為可繪制屬性的本機用法就是這樣。

android:src="@android:drawable/ic_dialog_email"

本地fab圖標

或從您正在使用的庫中,檢查實現

fab:fab_icon="@drawable/ic_fab_star"

輸出量 在此處輸入圖片說明

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM