خرید بک لینک

Vote count: 0

I am very new to Java / Android programing. Android Studio offered me a layout that consists in a menu like such:

<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">

    <group android:checkableBehavior="single">
        <item
            android:id="@+id/nav_empty"
            android:icon="@drawable/ic_menu_send"
            android:title="Empty" />
        <item
            android:id="@+id/nav_quotes"
            android:icon="@drawable/ic_menu_send"
            android:title="Quotes" />
        <item
            android:id="@+id/nav_info"
            android:icon="@drawable/ic_menu_send"
            android:title="Information" />
    </group>

</menu>

For now I'm trying to make the second item of the menu work, here's where I am when I press it:

 @SuppressWaings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        // Handle navigation view item clicks here.
        int id = item.getItemId();

        if (id == R.id.nav_empty) {

        } else if (id == R.id.nav_quotes) {
            Intent intent = new Intent(this, QuotesActivity.class);
            startActivity(intent);  // start the newly created Intent
        } else if (id == R.id.nav_info) {

        }

        DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        retu true;
    }

As you can see I create an Intent that leads me to QuotesActivity, but once I enter this page, the menu that was on the top left (classic clickable android menu) disappears.

Here's the activity_quotes.xml file for the QuotesActivity:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin"
    tools:context="com.example.kade_c.plus.QuotesActivity">

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textAppearance="?android:attr/textAppearanceLarge"
        android:text="@string/quote_welcome"
        android:id="@+id/textView_quotes"
        android:layout_marginTop="236dp"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/quotes_button"
        android:id="@+id/button_quotes"
        android:onClick="onClick"
        android:layout_marginBottom="184dp"
        android:layout_alignParentBottom="true"
        android:layout_centerHorizontal="true" />

</RelativeLayout>

What can I do to give the user the possibility to access the menu at any given time? Additionally, if you see flaws in how I proceed, please let me know !

Thank you.

asked 39 secs ago

برچسب: نویسنده: استخدام کار تاريخ: پنجشنبه 17 تير 1395 ساعت: 6:57

صفحه بندی