1

Hi i'm new at programming.

I followed this great tutorial and it all works just fine.

Now i'am trying to do two things:

  1. Create a picture in the top of the NavDrawer(want to call a profilepicture and name here and make it a button at the same time)

  2. And to add buttons to the top menu.

I tried a lot of different approaches without any success.

Do you have any tips about how to do this ?

I'm using Android studio. Thanks in advance.

Strings.xml:

    <?xml version="1.0" encoding="utf-8"?>
<resources>

<string name="app_name">Rider</string>
<string name="action_settings">Settings</string>
<string name="hello_world">Hello world!</string>
<string name="drawer_open">Rider Menu Opened</string>
<string name="drawer_close">Rider Menu Closed</string>

<!-- Nav Drawer Menu Items -->
<string-array name="nav_drawer_items">

    <item >Profile</item>
    <item >Club</item>
    <item >Points of interest</item>
    <item >Calender</item>
    <item >Help</item>
    <item >Share</item>
</string-array>

<!-- Nav Drawer List Item Icons -->
<!-- Keep them in order as the titles are in -->
<array name="nav_drawer_icons">

    <item>@drawable/ic_home</item>
    <item>@drawable/ic_people</item>
    <item>@drawable/ic_photos</item>
    <item>@drawable/ic_communities</item>
    <item>@drawable/ic_pages</item>
    <item>@drawable/ic_whats_hot</item>
</array>

<!-- Content Description -->
<string name="desc_list_item_icon">Item Icon</string>

fragment_profile.xml:

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


<TextView
    android:id="@+id/txtLabel"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_centerInParent="true"
    android:textSize="16dp"
    android:text="Profile"
    android:textStyle="bold" />

<ImageView android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_below="@id/txtLabel"
    android:src="@drawable/ic_home"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="10dp"/>

</RelativeLayout>

ProfileFragment.java:

package info.androidhive.slidingmenu;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class ProfileFragment extends Fragment {

public ProfileFragment(){}

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {

    View rootView = inflater.inflate(R.layout.fragment_profile, container, false);

    return rootView;
}
}

0 Answers0