Android - BOTTOM NAVIGATION VIEW SE ESCONDE (ERROR)

 
Vista:
sin imagen de perfil

BOTTOM NAVIGATION VIEW SE ESCONDE (ERROR)

Publicado por Sergio (1 intervención) el 21/09/2017 17:37:44
Tengo un problema con mi aplicación. Tengo un Bottom Navigation View con 3 fragments diferentes, aunque actualmente sólo en el principal tengo cosas puestas. El problema viene cuando intento pasar de uno de los dos fragmentos de la derecha al principal, que es cuando se oculta el bottom navigation view. No se que pasa y os agradecería que me ayudaseis. Os adjunto el código principal.

activity_main.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/containerr"
android:layout_width="match_parent"
android:layout_height="match_parent">
 
<FrameLayout
    android:id="@+id/container"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_gravity="bottom">
 
<android.support.design.widget.BottomNavigationView
    android:id="@+id/navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom"
    android:background="#0f6b96"
    app:itemIconTint="@drawable/color_state_light"
    app:itemTextColor="@drawable/color_state_light"
    app:menu="@menu/menu_bottom_navigation_basic">
 
</android.support.design.widget.BottomNavigationView>


MainActivity.java

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
BottomNavigationView bottomNavigationView;
 
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
 
    bottomNavigationView = (BottomNavigationView) findViewById(R.id.navigation);
    bottomNavigationView.setOnNavigationItemSelectedListener(onNavigationItemSelectedListener);
    FragmentManager fragmentManager = getSupportFragmentManager();
    FragmentTransaction transation = fragmentManager.beginTransaction();
    transation.replace(R.id.container, new Home()).commit();
 
 
}
private BottomNavigationView.OnNavigationItemSelectedListener onNavigationItemSelectedListener = new BottomNavigationView.OnNavigationItemSelectedListener() {
    @Override
    public boolean onNavigationItemSelected(@NonNull MenuItem item) {
 
        FragmentManager fragmentManager = getSupportFragmentManager();
        FragmentTransaction transation = fragmentManager.beginTransaction();
 
 
        switch (item.getItemId()){
 
            case R.id.home:
                transation.replace(R.id.container, new Home()).commit();
                return true;
 
            case R.id.ofertas:
                transation.replace(R.id.container, new Ofertas()).commit();
                return true;
 
            case R.id.contacto:
                transation.replace(R.id.container, new Contacto()).commit();
                return true;
 
        }
 
 
        return false;
    }
};

Os adjunto también un par de fotos:



Ofertas-Fragment


Home-Fragment
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder