Item showing only on click on BottomNavigationView
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
So I want a navigation bar at the bottom of the screen with 4 items but for some reason only the first one is showing and the others appear only when i click them.
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/white"
app:itemTextColor="@color/black"
app:menu="@menu/navigation_bar_bottom_menu" />
My menu:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_home"
android:title="@string/navigation_bar_home_text" />
<item
android:id="@+id/nav_inbox"
android:title="@string/navigation_bar_inbox_text" />
<item
android:id="@+id/nav_notes"
android:title="@string/navigation_bar_notes_text" />
<item
android:id="@+id/nav_profile"
android:title="@string/navigation_bar_profile_text" />
</menu>
The bar is displayed like this just with the first item showing:
android bottomnavigationview
add a comment |
So I want a navigation bar at the bottom of the screen with 4 items but for some reason only the first one is showing and the others appear only when i click them.
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/white"
app:itemTextColor="@color/black"
app:menu="@menu/navigation_bar_bottom_menu" />
My menu:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_home"
android:title="@string/navigation_bar_home_text" />
<item
android:id="@+id/nav_inbox"
android:title="@string/navigation_bar_inbox_text" />
<item
android:id="@+id/nav_notes"
android:title="@string/navigation_bar_notes_text" />
<item
android:id="@+id/nav_profile"
android:title="@string/navigation_bar_profile_text" />
</menu>
The bar is displayed like this just with the first item showing:
android bottomnavigationview
I think you can setvisibility:gone
and on click change it tovisibility:visibile
– amir133
Nov 15 '18 at 8:01
add a comment |
So I want a navigation bar at the bottom of the screen with 4 items but for some reason only the first one is showing and the others appear only when i click them.
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/white"
app:itemTextColor="@color/black"
app:menu="@menu/navigation_bar_bottom_menu" />
My menu:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_home"
android:title="@string/navigation_bar_home_text" />
<item
android:id="@+id/nav_inbox"
android:title="@string/navigation_bar_inbox_text" />
<item
android:id="@+id/nav_notes"
android:title="@string/navigation_bar_notes_text" />
<item
android:id="@+id/nav_profile"
android:title="@string/navigation_bar_profile_text" />
</menu>
The bar is displayed like this just with the first item showing:
android bottomnavigationview
So I want a navigation bar at the bottom of the screen with 4 items but for some reason only the first one is showing and the others appear only when i click them.
<com.google.android.material.bottomnavigation.BottomNavigationView
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:background="@color/white"
app:itemTextColor="@color/black"
app:menu="@menu/navigation_bar_bottom_menu" />
My menu:
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/nav_home"
android:title="@string/navigation_bar_home_text" />
<item
android:id="@+id/nav_inbox"
android:title="@string/navigation_bar_inbox_text" />
<item
android:id="@+id/nav_notes"
android:title="@string/navigation_bar_notes_text" />
<item
android:id="@+id/nav_profile"
android:title="@string/navigation_bar_profile_text" />
</menu>
The bar is displayed like this just with the first item showing:
android bottomnavigationview
android bottomnavigationview
asked Nov 15 '18 at 7:57
anMCanMC
306
306
I think you can setvisibility:gone
and on click change it tovisibility:visibile
– amir133
Nov 15 '18 at 8:01
add a comment |
I think you can setvisibility:gone
and on click change it tovisibility:visibile
– amir133
Nov 15 '18 at 8:01
I think you can set
visibility:gone
and on click change it to visibility:visibile
– amir133
Nov 15 '18 at 8:01
I think you can set
visibility:gone
and on click change it to visibility:visibile
– amir133
Nov 15 '18 at 8:01
add a comment |
2 Answers
2
active
oldest
votes
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@color/gray_background"
app:itemIconTint="@color/nav_item_state_list"
app:itemTextColor="@color/nav_item_state_list"
app:labelVisibilityMode="labeled"
android:theme="@style/Widget.BottomNavigationView"
app:menu="@menu/bottom_navigation_items"/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorPrimaryLite"
android:state_pressed="true"/>
<item android:color="@color/colorPrimaryLite"
android:state_checked="true"/>
<item android:color="@color/grayDark"
android:state_checked="false"/>
<item android:color="@color/white"/>
</selector>
After addingapp:labelVisibilityMode="labeled"
it worked. Thank you so much.
– anMC
Nov 15 '18 at 9:45
add a comment |
Here is the example
Create a color file
navigation_item_text_color.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@color/black" />
<item android:color="@android:color/darker_gray" />
</selector>
then put to color
folder (if you don't have color folder -> just create it manually)
Then
<com.google.android.material.bottomnavigation.BottomNavigationView
...
app:itemTextColor="@color/navigation_item_text_color" />
More
If you bottom menu item have icon, you can change icon color likeapp:itemIconTint="@color/navigation_item_text_color"
I've tried it but for some reason it still doesn't work :(
– anMC
Nov 15 '18 at 8:54
I have a small demo here, you can check it github.com/PhanVanLinh/AndroidBottomNavigationView
– Phan Van Linh
Nov 15 '18 at 9:04
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314754%2fitem-showing-only-on-click-on-bottomnavigationview%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@color/gray_background"
app:itemIconTint="@color/nav_item_state_list"
app:itemTextColor="@color/nav_item_state_list"
app:labelVisibilityMode="labeled"
android:theme="@style/Widget.BottomNavigationView"
app:menu="@menu/bottom_navigation_items"/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorPrimaryLite"
android:state_pressed="true"/>
<item android:color="@color/colorPrimaryLite"
android:state_checked="true"/>
<item android:color="@color/grayDark"
android:state_checked="false"/>
<item android:color="@color/white"/>
</selector>
After addingapp:labelVisibilityMode="labeled"
it worked. Thank you so much.
– anMC
Nov 15 '18 at 9:45
add a comment |
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@color/gray_background"
app:itemIconTint="@color/nav_item_state_list"
app:itemTextColor="@color/nav_item_state_list"
app:labelVisibilityMode="labeled"
android:theme="@style/Widget.BottomNavigationView"
app:menu="@menu/bottom_navigation_items"/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorPrimaryLite"
android:state_pressed="true"/>
<item android:color="@color/colorPrimaryLite"
android:state_checked="true"/>
<item android:color="@color/grayDark"
android:state_checked="false"/>
<item android:color="@color/white"/>
</selector>
After addingapp:labelVisibilityMode="labeled"
it worked. Thank you so much.
– anMC
Nov 15 '18 at 9:45
add a comment |
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@color/gray_background"
app:itemIconTint="@color/nav_item_state_list"
app:itemTextColor="@color/nav_item_state_list"
app:labelVisibilityMode="labeled"
android:theme="@style/Widget.BottomNavigationView"
app:menu="@menu/bottom_navigation_items"/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorPrimaryLite"
android:state_pressed="true"/>
<item android:color="@color/colorPrimaryLite"
android:state_checked="true"/>
<item android:color="@color/grayDark"
android:state_checked="false"/>
<item android:color="@color/white"/>
</selector>
<android.support.design.widget.BottomNavigationView
android:id="@+id/navigation"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_alignParentBottom="true"
android:background="@color/gray_background"
app:itemIconTint="@color/nav_item_state_list"
app:itemTextColor="@color/nav_item_state_list"
app:labelVisibilityMode="labeled"
android:theme="@style/Widget.BottomNavigationView"
app:menu="@menu/bottom_navigation_items"/>
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:color="@color/colorPrimaryLite"
android:state_pressed="true"/>
<item android:color="@color/colorPrimaryLite"
android:state_checked="true"/>
<item android:color="@color/grayDark"
android:state_checked="false"/>
<item android:color="@color/white"/>
</selector>
answered Nov 15 '18 at 9:20
veerendranveerendran
364
364
After addingapp:labelVisibilityMode="labeled"
it worked. Thank you so much.
– anMC
Nov 15 '18 at 9:45
add a comment |
After addingapp:labelVisibilityMode="labeled"
it worked. Thank you so much.
– anMC
Nov 15 '18 at 9:45
After adding
app:labelVisibilityMode="labeled"
it worked. Thank you so much.– anMC
Nov 15 '18 at 9:45
After adding
app:labelVisibilityMode="labeled"
it worked. Thank you so much.– anMC
Nov 15 '18 at 9:45
add a comment |
Here is the example
Create a color file
navigation_item_text_color.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@color/black" />
<item android:color="@android:color/darker_gray" />
</selector>
then put to color
folder (if you don't have color folder -> just create it manually)
Then
<com.google.android.material.bottomnavigation.BottomNavigationView
...
app:itemTextColor="@color/navigation_item_text_color" />
More
If you bottom menu item have icon, you can change icon color likeapp:itemIconTint="@color/navigation_item_text_color"
I've tried it but for some reason it still doesn't work :(
– anMC
Nov 15 '18 at 8:54
I have a small demo here, you can check it github.com/PhanVanLinh/AndroidBottomNavigationView
– Phan Van Linh
Nov 15 '18 at 9:04
add a comment |
Here is the example
Create a color file
navigation_item_text_color.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@color/black" />
<item android:color="@android:color/darker_gray" />
</selector>
then put to color
folder (if you don't have color folder -> just create it manually)
Then
<com.google.android.material.bottomnavigation.BottomNavigationView
...
app:itemTextColor="@color/navigation_item_text_color" />
More
If you bottom menu item have icon, you can change icon color likeapp:itemIconTint="@color/navigation_item_text_color"
I've tried it but for some reason it still doesn't work :(
– anMC
Nov 15 '18 at 8:54
I have a small demo here, you can check it github.com/PhanVanLinh/AndroidBottomNavigationView
– Phan Van Linh
Nov 15 '18 at 9:04
add a comment |
Here is the example
Create a color file
navigation_item_text_color.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@color/black" />
<item android:color="@android:color/darker_gray" />
</selector>
then put to color
folder (if you don't have color folder -> just create it manually)
Then
<com.google.android.material.bottomnavigation.BottomNavigationView
...
app:itemTextColor="@color/navigation_item_text_color" />
More
If you bottom menu item have icon, you can change icon color likeapp:itemIconTint="@color/navigation_item_text_color"
Here is the example
Create a color file
navigation_item_text_color.xml
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_checked="true" android:color="@color/black" />
<item android:color="@android:color/darker_gray" />
</selector>
then put to color
folder (if you don't have color folder -> just create it manually)
Then
<com.google.android.material.bottomnavigation.BottomNavigationView
...
app:itemTextColor="@color/navigation_item_text_color" />
More
If you bottom menu item have icon, you can change icon color likeapp:itemIconTint="@color/navigation_item_text_color"
answered Nov 15 '18 at 8:06
Phan Van LinhPhan Van Linh
22.4k12118147
22.4k12118147
I've tried it but for some reason it still doesn't work :(
– anMC
Nov 15 '18 at 8:54
I have a small demo here, you can check it github.com/PhanVanLinh/AndroidBottomNavigationView
– Phan Van Linh
Nov 15 '18 at 9:04
add a comment |
I've tried it but for some reason it still doesn't work :(
– anMC
Nov 15 '18 at 8:54
I have a small demo here, you can check it github.com/PhanVanLinh/AndroidBottomNavigationView
– Phan Van Linh
Nov 15 '18 at 9:04
I've tried it but for some reason it still doesn't work :(
– anMC
Nov 15 '18 at 8:54
I've tried it but for some reason it still doesn't work :(
– anMC
Nov 15 '18 at 8:54
I have a small demo here, you can check it github.com/PhanVanLinh/AndroidBottomNavigationView
– Phan Van Linh
Nov 15 '18 at 9:04
I have a small demo here, you can check it github.com/PhanVanLinh/AndroidBottomNavigationView
– Phan Van Linh
Nov 15 '18 at 9:04
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314754%2fitem-showing-only-on-click-on-bottomnavigationview%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
I think you can set
visibility:gone
and on click change it tovisibility:visibile
– amir133
Nov 15 '18 at 8:01