Nav Header with login

1

I have the navigation drawer menu and in the header part I have only one image. I would like to put the user to login. In kids I would like to leave as in the image below:

Iwouldliketoputtheimagethenameandtheemailoftheuseralreadyloggedin.Cansomeonehelpme,tellmeifit'stoohard?Thankyou.

Ihavethecode:

XML:

<?xmlversion="1.0" encoding="utf-8"?>

<TextView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:paddingTop="@dimen/nav_header_vertical_spacing"
    android:textSize="20dp"
    android:text="@string/label_header"
    android:textAppearance="@style/Base.TextAppearance.Widget.AppCompat.Toolbar.Subtitle"
    android:id="@+id/textView14"
    android:layout_centerVertical="true"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

<TextView
    android:id="@+id/textViewLogo"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="@string/label_headerSmall"
    android:layout_gravity="center_horizontal"
    android:layout_below="@+id/textView14"
    android:layout_alignParentLeft="true"
    android:layout_alignParentStart="true" />

    
asked by anonymous 20.07.2016 / 14:40

2 answers

1

Artur, beauty?

Dude, you have a very good book by Professor Nelson Glauber, the first Google Developer Expert in Latin America. And in it has a chapter that he deals exactly what he needs, a Navigation Drawer with login, in the case with Google Plus and already pulls the photo of the user. Below is the book link, if you'd like to take a look, and Github with all the sources in this chapter of the book. Hope this helps. Hugs

Book

GitHub

    
21.07.2016 / 18:50
1

Talk to Artur,

You'd better handle this right in Java, when the user logs in, you save it to the local database, right?

Before setting the name and email values of the logged-in user, you do an example if:

if(logado){
    nome.setText(nome);
    email.setText(email);
}else{
    nome.setText("Você precisa se logar");
    email.setVisibility(View.GONE);
}

Hugs.

    
20.07.2016 / 15:06