2017-11-06 8 views
-4

ラベルバックグラウンドを50%透明にするにはどうすればよいですか?FABラベルバックラウンドの作成方法50%不透明度

enter image description here

私はandroid:alpha ="0.5"を使用して試してみたが、出力はサブメニューが透明の50%を回しているある

+0

イム:FAB:1.6.2 – MNGorospe

+0

読み取りhttps://stackoverflow.com/questions/11285961/how-to-make-a-background- 20透明オンアンドロイド –

+0

@IntelliJAmiyaがhi、IVEは、それが、サブメニューボタンは以下 ''のような透明不透明 – MNGorospe

答えて

1

レイアウトにlable

<com.github.clans.fab.FloatingActionMenu 
    android:id="@+id/menu_yellow" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:layout_alignParentBottom="true" 
    android:layout_alignParentRight="true" 
    android:layout_marginRight="80dp" 
    android:layout_marginBottom="10dp" 
    android:layout_marginLeft="10dp" 
    android:layout_marginTop="10dp" 
    fab:menu_labels_style="@style/MenuLabelsStyle" 
    fab:menu_labels_showAnimation="@anim/jump_from_down" 
    fab:menu_labels_hideAnimation="@anim/jump_to_down" 
    fab:menu_animationDelayPerItem="0" 
    fab:menu_shadowColor="#444" 
    fab:menu_colorNormal="#FFB805" 
    fab:menu_colorPressed="#F2AB00" 
    fab:menu_colorRipple="#D99200"> 

    <com.github.clans.fab.FloatingActionButton 
     android:id="@+id/fab12" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_edit" 
     fab:fab_label="Menu item 1" 
     fab:menu_labels_style="@style/MenuButtonsStyle"/> 

    <com.github.clans.fab.FloatingActionButton 
     android:id="@+id/fab22" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_edit" 
     fab:fab_label="Menu item 2" 
     style="@style/MenuButtonsStyle" /> 

    <com.github.clans.fab.FloatingActionButton 
     android:id="@+id/fab32" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:src="@drawable/ic_edit" 
     fab:fab_label="@string/lorem_ipsum" 
     style="@style/MenuButtonsStyle" /> 

</com.github.clans.fab.FloatingActionMenu> 

をファブには、以下の設定してみてくださいxml。 とcom.github.clansを使用して、こののstyles.xmlで

<style name="MenuLabelsStyle"> 
    <item name="android:background">#7b000000</item> 
    <item name="android:textColor">#FFFFFF</item> 
    <item name="android:textSize">14sp</item> 
    <item name="android:maxLines">2</item> 
    <item name="android:ellipsize">end</item> 
</style> 

<style name="MenuButtonsStyle"> 
    <item name="fab_size">mini</item> 
    <item name="fab_showAnimation">@anim/jump_from_down</item> 
    <item name="fab_hideAnimation">@anim/jump_to_down</item> 
    <item name="fab_shadowColor">#7e444444</item> 
    <item name="fab_colorNormal">#FFB805</item> 
    <item name="fab_colorPressed">#F2AB00</item> 
    <item name="fab_colorRipple">#D99200</item> 
</style> 
+0

こんにちは、 "app"はxmlファイル – MNGorospe

+0

の代わりに "fab"を使用して、更新されたコードを試してみてください... – Omi

+0

はまだmenu_labels_styleには提案されていません。助けてくれてありがとう: – MNGorospe