Devlight / NavigationTabBar

Navigation tab bar with colorful interactions.
Apache License 2.0
4.95k stars 858 forks source link

menu without a title #33

Closed baoxin closed 8 years ago

baoxin commented 8 years ago

I am a Chinese but English is not very good, I use your library, but the menu does not have a title, I try to use your demo,it dose not have a title too. I don't know what's wrong?

GIGAMOLE commented 8 years ago

Hello. Thanks for question. There are a list of examples activities in sample app. You can look there and also check source code to resolve your issue.

baoxin commented 8 years ago

Yeah, I'm trying to do that.

GIGAMOLE commented 8 years ago

And what?

darcheville06 commented 8 years ago

Hello, i have the same issue with french language title and badge do not show

darcheville06 commented 8 years ago
    <com.gigamole.navigationtabbar.ntb.NavigationTabBar
        android:id="@+id/navigationTabBar"
                android:layout_alignParentBottom="true"
    android:layout_width="match_parent"
                android:layout_height="60dp"
                app:ntb_badge_gravity="top"
                app:ntb_badge_position="right"
                app:ntb_badged="true"
                app:ntb_scaled="true"
                app:ntb_tinted="true"
                app:ntb_title_mode="all"
                app:ntb_titled="true"
                app:ntb_swiped="true"/>
darcheville06 commented 8 years ago
        final ArrayList<NavigationTabBar.Model> models = new ArrayList<NavigationTabBar.Model>()
        {
            {
                add(new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.icone_profile_tab),
                        Color.parseColor("#000000")
                ).title(getString(R.string.tab_bar_profil))
                        .build());

                add(new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.tab_bar_icone_missions),
                        Color.parseColor("#000000")
                ).title(getString(R.string.tab_bar_missions))
                        .build());

                add(new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.icone_push_tab),
                        Color.parseColor("#000000")
                ).build());

                add(new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.icone_activites_tab),
                        Color.parseColor("#000000")
                )
                        .title(getString(R.string.tab_bar_histoires))
                        .build());

                add(new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.icone_circuit_tab),
                        Color.parseColor("#000000") // fond du linearlayout quand actif
                ).title(getString(R.string.tab_bar_circuits))
                        .build());

            }
        };
        navigationTabBar.setModels(models);

        //setBackgroundColor ne marche pas
        navigationTabBar.setActiveColor(getResources().getColor(R.color.white)); //couleur de l'icone quand actif
        navigationTabBar.setInactiveColor(getResources().getColor(R.color.white)); //couleur de l'icone quand pas actif

        navigationTabBar.setBgColor(getResources().getColor(R.color.tab_bar_non_selectionne));//fond de couleur quand pas actif

        navigationTabBar.setViewPager(mViewPager, Prefs.getInt(GlobalConfig.SHARED_PREFERENCES_CURRENT_TAB, 2));

no error but they dont show

baoxin commented 8 years ago

<com.gigamole.navigationtabbar.ntb.NavigationTabBar android:id="@+id/navTabBar" android:layout_width="match_parent" android:layout_height="50dp" android:layout_alignParentBottom="true" app:ntb_badge_gravity="top" app:ntb_badge_position="right" app:ntb_badged="true" app:ntb_scaled="true" app:ntb_tinted="true" app:ntb_title_mode="all" app:ntb_bg_color="@color/white" app:ntb_titled="true" app:ntb_swiped="true"/>

GIGAMOLE commented 8 years ago

Do you set titles in models? And what color of your titles?

GIGAMOLE commented 8 years ago

Maybe your fonttype doesnt provide any symbols for your languages?

darcheville06 commented 8 years ago

How do you set the color of the titles please?

GIGAMOLE commented 8 years ago

Can you send me yout strings?

darcheville06 commented 8 years ago
<string name = "tab_bar_profil">Profile</string>
<string name = "tab_bar_missions">Quizz</string>
<string name = "tab_bar_histoires">Activities</string>
<string name = "tab_bar_circuits">Circuits</string>
GIGAMOLE commented 8 years ago

Its so interesting.

GIGAMOLE commented 8 years ago

I dont know what is the problem is. I`ve tested on many langs and there was ok.

GIGAMOLE commented 8 years ago

Its seems like your method of getString(R.string.tab_bar_histoires) returns to you "". Try to log this.

darcheville06 commented 8 years ago

maybe a conflict with an other library

compile 'com.github.MKergall:osmbonuspack:v5.8.1'
compile 'org.osmdroid:osmdroid-android:5.2@aar'
compile 'com.orhanobut:dialogplus:1.11@aar'
compile 'com.github.frank-zhu:pullzoomview:1.0.0'
compile 'com.facebook.android:facebook-android-sdk:+'
compile 'com.github.dmytrodanylyk.android-process-button:library:1.0.4'
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
compile 'com.squareup.okhttp3:okhttp:3.2.0'
compile 'com.github.2359media:EasyAndroidAnimations:0.8'
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.google.android.gms:play-services-analytics:+'
compile 'com.mobsandgeeks:android-saripaar:+'
compile 'com.google.android.gms:play-services-location:+'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.jaredrummler:android-device-names:1.0.9'
compile 'com.android.support:multidex:1.0.1'
compile 'com.android.support:design:24.0.0'
compile 'info.hoang8f:fbutton:1.0.5'
compile 'uk.co.chrisjenx:calligraphy:2.2.0'
compile 'com.android.support:recyclerview-v7:24.0.0'
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'org.greenrobot:eventbus:3.0.0'
compile 'com.github.johnkil.android-progressfragment:progressfragment:1.4.+'
compile 'de.hdodenhof:circleimageview:+'
compile 'com.google.android.gms:play-services-panorama:+'
compile 'com.github.halysongoncalves:pugnotification:1.8.1'
compile 'com.commonsware.cwac:cam2:0.6.2'
compile 'com.infstory:recyclerlist:1.0.0'
compile 'com.kogitune:pre-lollipop-activity-transition:+'
compile 'com.github.pwittchen:reactivenetwork:0.2.0'
compile('net.i2p.android.ext:floatingactionbutton:1.10.0') {
    exclude module: "library"
}
compile 'com.makeramen:roundedimageview:2.2.1'
compile 'com.github.dmytrodanylyk.shadow-layout:library:1.0.1'
compile 'com.squareup.leakcanary:leakcanary-android:+'
compile 'org.zeroturnaround:zt-zip:1.9'
compile 'com.pixplicity.easyprefs:library:+'
compile 'com.github.jd-alexander:library:1.1.0'
compile 'com.github.viethoa:fastscroller:1.1.0'
compile 'com.github.fenjuly:ArrowDownloadButton:9e15b85e8a'
compile 'com.github.vlonjatg:progress-activity:v1.0.3'
compile('com.github.gabrielemariotti.recyclerview:recyclerview-animators:0.3.0-SNAPSHOT@aar') {
    exclude module: "okhttp"
}
compile('com.twitter.sdk.android:twitter:+') {
    transitive = true;
}
compile 'com.karumi:dexter:2.2.2'
compile 'com.hedgehog.ratingbar:app:1.0.4'
compile 'com.google.android.gms:play-services:+'
compile 'com.jonathanfinerty.expandabletextview:expandabletextview:0.0.2'
compile 'io.reactivex:rxandroid:1.2.0'
compile 'com.sangcomz:FishBun:0.4.4@aar'
//compile 'cn.finalteam:galleryfinal:1.4.8.7'
compile 'com.github.NightWhistler:HtmlSpanner:+'
//compile 'com.jakewharton:butterknife:8.0.1'

//apt 'com.jakewharton:butterknife-compiler:8.0.1'
compile 'com.anjlab.android.iab.v3:library:1.0.+'
compile 'com.joanzapata.iconify:android-iconify:+'
compile 'com.joanzapata.iconify:android-iconify-fontawesome:+'
compile 'com.github.thorbenprimke:realm-searchview:+'
compile 'com.jakewharton:butterknife:7.0.1'
compile 'com.pacioianu.david:ink-page-indicator:1.2.0'
compile 'com.github.johnpersano:supertoasts:1.3.4@aar'
compile 'com.estimote:sdk:0.10.5@aar'
compile 'com.github.medyo:fancybuttons:1.8.1'
compile 'com.rengwuxian.materialedittext:library:2.1.4'
compile 'com.github.dmytrodanylyk.shadow-layout:library:1.0.3'
compile 'com.github.devlight.navigationtabbar:navigationtabbar:1.2.3'
darcheville06 commented 8 years ago

will try to log it

GIGAMOLE commented 8 years ago

No. This is problem on your side.

baoxin commented 8 years ago

A yes, it's our problem, the sample code can run normally

darcheville06 commented 8 years ago

Mhhh the logs are correct, its really strange because the demo are ok

baoxin commented 8 years ago

Well, it is very strange

GIGAMOLE commented 8 years ago

Maybe your strings placed in not default folder of /values or /string.xml. Maybe there are some flag for this path like lang etc.

darcheville06 commented 8 years ago

i am trying this

final String[] colors = getResources().getStringArray(R.array.default_preview); final ArrayList models = new ArrayList();

        models.add(
                new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.ic_third),
                        Color.parseColor(colors[0]))
                        .selectedIcon(getResources().getDrawable(R.drawable.ic_third))
                        .title("Heart")
                        .badgeTitle("NTB")
                        .build()
        );
        models.add(
                new NavigationTabBar.Model.Builder(
                        getResources().getDrawable(R.drawable.ic_third),
                        Color.parseColor(colors[1]))

// .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) .title("Cup") .badgeTitle("with") .build() ); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.drawable.ic_third), Color.parseColor(colors[2])) .selectedIcon(getResources().getDrawable(R.drawable.ic_third)) .title("Diploma") .badgeTitle("state") .build() ); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.drawable.ic_third), Color.parseColor(colors[3])) // .selectedIcon(getResources().getDrawable(R.drawable.ic_eighth)) .title("Flag") .badgeTitle("icon") .build() ); models.add( new NavigationTabBar.Model.Builder( getResources().getDrawable(R.drawable.ic_third), Color.parseColor(colors[4])) .selectedIcon(getResources().getDrawable(R.drawable.ic_third)) .title("Medal") .badgeTitle("777") .build() );

        navigationTabBar.setModels(models);

        //setBackgroundColor ne marche pas
        navigationTabBar.setActiveColor(getResources().getColor(R.color.white)); //couleur de l'icone quand actif
        navigationTabBar.setInactiveColor(getResources().getColor(R.color.white)); //couleur de l'icone quand pas actif

        navigationTabBar.setBgColor(getResources().getColor(R.color.tab_bar_non_selectionne));//fond de couleur quand pas actif

        DebugUtilities.displayInConsole("TOTO : " + getString(R.string.tab_bar_profil));

        navigationTabBar.setViewPager(mViewPager, Prefs.getInt(GlobalConfig.SHARED_PREFERENCES_CURRENT_TAB, 2));

        navigationTabBar.setOnTabBarSelectedIndexListener(new NavigationTabBar.OnTabBarSelectedIndexListener() {
            @Override
            public void onStartTabSelected(NavigationTabBar.Model model, int index) {
                try {
                    Prefs.putInt(GlobalConfig.SHARED_PREFERENCES_CURRENT_TAB, index);
                } catch (Exception e) {
                    new ExceptionManager(e, MonumentTrackerApplication.context);
                }
            }

            @Override
            public void onEndTabSelected(NavigationTabBar.Model model, int index) {

            }
        });
baoxin commented 8 years ago

What's the reason why I found. Cannot use relativelayout parent layout

darcheville06 commented 8 years ago

mhhh i use parent relativelayout

darcheville06 commented 8 years ago

will try with linearlayout

baoxin commented 8 years ago

linearlayout is ok

darcheville06 commented 8 years ago

no it does not work with linearlayout too :/

darcheville06 commented 8 years ago

ok it works with linearlayout like that <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:tools="http://schemas.android.com/tools" android:background="#423752" android:orientation="vertical">

<com.monumentTrackerAddictive.Coeur.Fragments.NonScrollingViewPager
    android:id="@+id/viewpager"
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:layout_weight="1"/>

<com.gigamole.navigationtabbar.ntb.NavigationTabBar
    android:id="@+id/navigationTabBar"
    android:layout_width="match_parent"
    android:layout_height="60dp"
    app:ntb_badge_gravity="top"
    app:ntb_badge_position="right"
    app:ntb_badged="true"
    app:ntb_scaled="true"
    app:ntb_tinted="true"
    app:ntb_title_mode="all"
    app:ntb_titled="true"
    app:ntb_swiped="true"/>

<include
    android:layout_alignParentTop="true"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    layout="@layout/navigation_action_bar_progression" />

darcheville06 commented 8 years ago

i have the titles finally :)

darcheville06 commented 8 years ago

Thank you very much for your help

baoxin commented 8 years ago

:)

GIGAMOLE commented 8 years ago

You welcome.