Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Center icon only not show #41

Closed
loidoantitan opened this issue Aug 15, 2017 · 11 comments
Closed

Center icon only not show #41

loidoantitan opened this issue Aug 15, 2017 · 11 comments

Comments

@loidoantitan
Copy link

icon_add
I use icon this , but not show when set center icon only. Help me

Thanks Alo

@ittianyu
Copy link
Owner

Please show me your code.

@loidoantitan
Copy link
Author

loidoantitan commented Aug 15, 2017

Menu:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
    <item
        android:id="@+id/navigation_engagement"
        android:checked="true"
        android:icon="@drawable/folder_con"
        android:title="@string/title_engagement" />

    <item
        android:id="@+id/navigation_mytodos"
        android:icon="@drawable/check_ico"
        android:title="@string/title_dashboard" />
    <!--must set the item title to empty-->
    <item
        android:id="@+id/menu_add"
        android:icon="@drawable/icon_add"
        android:title="" />
    <item
        android:id="@+id/navigation_activity"
        android:icon="@drawable/active_ico"
        android:title="@string/title_notifications" />
    <item
        android:id="@+id/navigation_file"
        android:icon="@drawable/file_ico"
        android:title="@string/title_files" />
</menu>

XMl :

<com.auvenir.ui.BottomNavigationViewEx
        android:id="@+id/navigation"
        style="@style/bnve_primary_bg"
        android:layout_gravity="bottom"
        app:itemIconTint="@color/selector_item_gray_color"
        app:itemTextColor="@color/selector_item_gray_color"
        app:menu="@menu/menu_navigation_center_icon_only" />

Java code:

navigation = (BottomNavigationViewEx) findViewById(R.id.navigation);
        navigation.setOnNavigationItemSelectedListener(this);
        navigation.enableAnimation(false);
        navigation.enableShiftingMode(false);
        navigation.enableItemShiftingMode(false);
        int centerPosition = 2;
        navigation.setIconSizeAt(centerPosition, 48, 48);
        navigation.setTextSize(10);
        navigation.setIconMarginTop(centerPosition, BottomNavigationViewEx.dp2px(this, 4));
        navigation.setItemBackground(centerPosition, R.color.white);

        navigation.setIconTintList(centerPosition,
                getResources().getColorStateList(R.color.selector_item_center));

@loidoantitan
Copy link
Author

Can you help me? Thanks

@ittianyu
Copy link
Owner

Can't find the problem. Can you share me the project ?
Or you can try another method to show center icon only.

  1. clear center menu icon
  2. add FloatingActionButton at bottom center..
  3. Control the tab click click listener.

@ittianyu
Copy link
Owner

Sorry, not have time today. I will reply at tomorrow.

@loidoantitan
Copy link
Author

loidoantitan commented Aug 15, 2017

I use app of you https://github.com/ittianyu/BottomNavigationViewEx/tree/master/app change menu_navigation_center_icon_only.xml of you. I add icon
<item android:id="@+id/menu_add" android:icon="@drawable/ic_add_48dp" android:title="" />

to
<item android:id="@+id/menu_add" android:icon="@drawable/icon_add" android:title="" />
then not show.

@loidoantitan
Copy link
Author

You can help me when I have free time!

@ittianyu
Copy link
Owner

I just try your image. It not works. May be you need a svg instead of png.
You can find some images here: http://www.iconfont.cn/search/index?searchType=icon&q=add
I think png is ok. But may be can't mix with svg. I means all item use png.

@loidoantitan
Copy link
Author

So My icon not works?

@ittianyu
Copy link
Owner

Try to use svg or use five png.

@loidoantitan
Copy link
Author

I use file png and svg not work with my icon. I think Some other color icons (not black color, color white) then not works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants