JoseSnoopy
Lurker
First of all thanks to read me and try to help me.
Im starting with Android Studio so im new here.
Im working with Android Studio and im doing an app to learn android but i have a problem and i am so frustrated. I have made a navigation drawer and everything its ok but i dont have an appbar so i have tried to put this in my app ... but i have a big problem.
When i put the appbar i cant see my fragments because there is a blue screen over my fragments, i can interactuate with the fragments but i cant see them.
This is my welcome page, i cant see the default fragment because there is a blue screen over my fragment:
I can open my navigationDrawer but when i do click in one fragment, i only can see the blue screen... So what could be the problem?
Im so frustrated and i dont know what can i do.
I leave the code here:
java:
layout:
If you need something more just tell me.
Thank you again to read me and try to help me guys.
Im starting with Android Studio so im new here.
Im working with Android Studio and im doing an app to learn android but i have a problem and i am so frustrated. I have made a navigation drawer and everything its ok but i dont have an appbar so i have tried to put this in my app ... but i have a big problem.
When i put the appbar i cant see my fragments because there is a blue screen over my fragments, i can interactuate with the fragments but i cant see them.
This is my welcome page, i cant see the default fragment because there is a blue screen over my fragment:
I can open my navigationDrawer but when i do click in one fragment, i only can see the blue screen... So what could be the problem?
Im so frustrated and i dont know what can i do.
I leave the code here:
java:
Java:
public class NavigationDrawerAct extends AppCompatActivity
implements NavigationView.OnNavigationItemSelectedListener {
private static final String MENU_ITEM = "MenuItem";
private Toolbar toolbar;
private DrawerLayout drawer;
private ActionBarDrawerToggle toggle;
private NavigationView navigationView;
private MenuItem menuItem;
private android.support.v4.app.FragmentManager fragmentManager;
private android.support.v7.app.ActionBar actionBar;
@Override
protected void onCreate(Bundle savedInstanceState) {
ApiIGDBpeiticiones miapi=new ApiIGDBpeiticiones(this);
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_navigation_drawer);
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
/*APPBAR*/
toolbar.inflateMenu(R.menu.menu_main);
actionBar = getSupportActionBar();
actionBar.setHomeAsUpIndicator(R.drawable.ic_menu);
actionBar.setDisplayHomeAsUpEnabled(true);
/*APPBAR*/
drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
toggle = new ActionBarDrawerToggle(
this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.addDrawerListener(toggle);
toggle.syncState();
navigationView = (NavigationView) findViewById(R.id.nav_view_2);
navigationView.setNavigationItemSelectedListener(this);
listatop listatop = new listatop();
//Add fragment
fragmentManager = getSupportFragmentManager();
fragmentManager.beginTransaction()
.replace(R.id.navigation_fragment, listatop)
.commit();
}
layout:
Code:
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fitsSystemWindows="true"
android:orientation="vertical"
tools:openDrawer="start">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:theme="@style/AppTheme.AppBarOverlay">
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="?attr/colorPrimaryDark"
app:popupTheme="@style/AppTheme.PopupOverlay" />
</android.support.design.widget.AppBarLayout>
<FrameLayout
android:id="@+id/navigation_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<android.support.design.widget.NavigationView
android:id="@+id/nav_view_2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="start"
android:fitsSystemWindows="true"
app:headerLayout="@layout/nav_header_navigation_drawer"
app:menu="@menu/activity_navigation_drawer_drawer" />
</android.support.v4.widget.DrawerLayout>
If you need something more just tell me.
Thank you again to read me and try to help me guys.