How to remove titles (at runtime) and decrease the size of Floatingactionbutton?

Asked

Viewed 30 times

1

I have a menu, with floating action Buttons and would like to know how it is possible to put them smaller than the normal size, because they are equal, in size, to the menu, even open and the fabsize property does not work. And how to remove the title programmatically when clicking a button of these?

XML:

<com.getbase.floatingactionbutton.FloatingActionsMenu
                android:id="@+id/map_btn_compartilhar"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_alignBottom="@+id/pink_icon"
                android:layout_alignEnd="@+id/multiple_actions_down"
                android:layout_alignRight="@+id/multiple_actions_down"
                android:layout_gravity="bottom|end"
                android:layout_margin="@dimen/fab_margin"
                android:src="@drawable/ic_share_white_24dp"
                app:fab_addButtonStrokeVisible="true"
                fab:fab_addButtonColorNormal="@color/fundo_3"
                fab:fab_addButtonColorPressed="@color/fundo_1"
                fab:fab_labelStyle="@style/menu_labels_style">

                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:id="@+id/fab_ativa_map"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_map_24dp_branco_deactive"
                    fab:fab_colorNormal="@color/white"
                    fab:fab_colorPressed="@color/white_pressed"
                    fab:fab_title="@string/ativarmap_map"/>

                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:id="@+id/fab_filtra_map"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_24dp_branco_deactive"
                    fab:fab_colorNormal="@color/white"
                    fab:fab_colorPressed="@color/fundo_2"
                    fab:fab_title="@string/filtra_map"/>

                <com.getbase.floatingactionbutton.FloatingActionButton
                    android:id="@+id/fab_parar_map"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:src="@drawable/ic_24dp_branco_active"
                    android:visibility="gone"
                    fab:fab_colorNormal="@color/fundo_1"
                    fab:fab_colorPressed="@color/fundo_2"
                    fab:fab_title="@string/pararmap_map" />

</com.getbase.floatingactionbutton.FloatingActionsMenu>

Example of FAB code:

fabAtivamap = (com.getbase.floatingactionbutton.FloatingActionButton) activity.findViewById(R.id.fab_ativa_map);
        fabAtivamap.setVisibility(View.VISIBLE);       
        fabAtivamap.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {                            
                ......
                // Reseta os botões
                fabPararmap.setVisibility(View.VISIBLE);
                fabAtivamap.setVisibility(View.GONE);
                fabFiltramap.setVisibility(View.VISIBLE);
                fabAtivamap.setTitle("");//retirar os titulos
                ......
});

1 answer

0

Do you have any special reason to use a library that the author himself says is extremely limited?

I don’t know if this will work library, but using FAB from material library design, you control the size so:

app:fabSize="mini"

For minimum size (standard 40x40 dp)

app:fabSize="normal"

For normal size (standard 56x56 dp)

Try and see if it works, or stop using this library, that then, it will work.

  • I used it because that’s what I thought at the time. Like I said, it doesn’t work, that’s how you showed me.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.