2017-06-06 115 views
0

我正在嘗試使用this framework實現浮動按鈕操作。我的問題是,菜單的項目與主按鈕的大小相同,即使使用「mini」,也不顯示標籤的文字。圖像波紋管: enter image description hereAndroid FloatingActionMenu未顯示標籤

的XML:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:fab="http://schemas.android.com/tools"> 

    <com.github.clans.fab.FloatingActionMenu 
     android:id="@+id/material_design_android_floating_action_menu" 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:layout_alignParentBottom="true" 
     android:layout_alignParentRight="true" 
     android:layout_marginBottom="63dp" 
     android:layout_marginLeft="11dp" 
     android:layout_marginRight="11dp" 
     fab:menu_animationDelayPerItem="55" 
     fab:menu_backgroundColor="@android:color/transparent" 
     fab:menu_buttonSpacing="0dp" 
     fab:menu_colorNormal="#da3c2f" 
     fab:menu_colorPressed="#dc4b3f" 
     fab:menu_colorRipple="#99d4d4d4" 
     fab:menu_fab_label="Floating Action Menu" 
     fab:menu_fab_size="normal" 
     fab:menu_icon="@drawable/fab_add" 
     fab:menu_labels_colorNormal="#333" 
     fab:menu_labels_colorPressed="#444" 
     fab:menu_labels_colorRipple="#66efecec" 
     fab:menu_labels_cornerRadius="3dp" 
     fab:menu_labels_ellipsize="none" 
     fab:menu_labels_hideAnimation="@anim/fab_slide_out_to_right" 
     fab:menu_labels_margin="0dp" 
     fab:menu_labels_maxLines="-1" 
     fab:menu_labels_padding="8dp" 
     fab:menu_labels_position="left" 
     fab:menu_labels_showAnimation="@anim/fab_slide_in_from_right" 
     fab:menu_labels_showShadow="true" 
     fab:menu_labels_singleLine="false" 
     fab:menu_labels_textColor="#f2f1f1" 
     fab:menu_labels_textSize="15sp" 
     fab:menu_openDirection="up" 
     fab:menu_shadowColor="#66aff198" 
     fab:menu_shadowRadius="4dp" 
     fab:menu_shadowXOffset="1dp" 
     fab:menu_shadowYOffset="4dp" 
     fab:menu_showShadow="true"> 

     <com.github.clans.fab.FloatingActionButton 
      android:id="@+id/material_design_floating_action_menu_item1" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/ic_star" 
      fab:fab_label="Menu Item 1" 
      fab:fab_size="mini" /> 

     <com.github.clans.fab.FloatingActionButton 
      android:id="@+id/material_design_floating_action_menu_item2" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/ic_star_half_empty" 
      fab:fab_label="Menu Item 2" 
      fab:fab_size="mini" /> 

     <com.github.clans.fab.FloatingActionButton 
      android:id="@+id/material_design_floating_action_menu_item3" 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:src="@drawable/ic_info" 
      fab:fab_label="Menu Item 3" 
      fab:fab_size="mini" /> 

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

</RelativeLayout> 

我有一個很難搞清楚什麼我失蹤使它工作like this

感謝您的幫助。

回答

1

更改此:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
xmlns:fab="http://schemas.android.com/tools"> 

到:

<?xml version="1.0" encoding="utf-8"?> 
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
xmlns:fab="http://schemas.android.com/apk/res-auto" 
xmlns:app="http://schemas.android.com/tools"> 

注意在的xmlns變化:FAB

+0

謝謝您的回答!我嘗試了你說的話,但是這個程序不會編譯。我不得不改變晶圓廠:對於應用程序: –

+0

好吧....你可以編輯答案儘管..thankx – rafsanahmad007